[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Chinese Children's Cartoons Imageboard

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 54
Thread images: 8

File: cmd_2017-06-20_22-34-45.png (19KB, 607x396px) Image search: [Google]
cmd_2017-06-20_22-34-45.png
19KB, 607x396px
Hey /g/
you know that meme where we call 4chan a "chinese cartoons imageboard" or "norwegian goat herding forum" or whatever

i made a program that randomly generates names

it generates lists from the three txt files (they have to be in the directory with the executable, you can change them, line limit of 50 characters), then just throws them together.

> https://github.com/JaxonSkye/chan.git
Three .txt modifiable dictionaries, the source code, and an already compiled executable.
What do you think?
>>
>>61001639
this was completely necessary and i applaud you for your effort
>>
>>61001639
I wrote this same thing like two years ago

I'm glad someone else on a Libyan Mountain-biking forum had this idea
>>
>>61001639
>Cambodian Neurosurgery Fraternity
Good work, anon.
>>
>>61001639
>Coptic AMD Onion Node
cyberpunk af
>>
>>61001639
>not making it deep learn the meme for infinite lulz
at least it was a fun 5 min programming exercise that you could post on a mongolian basketweaving bbs
>>
>>61001801
>>not making it deep learn the meme for infinite lulz

are you legitimately 15 years old
>>
>>61001639
>French Canadian roleplaying microbrewery
lol
>>
>>61001801
so he could crawl a guatemalan beekeeping forum for instances of the meme, record what actual anons post, and use that to weight the probabilities of the words it chooses?
>>
is called an croat hand waxing tabloid you mongoloids
>>
>>61001835
more than double that lol xDDD

>>61001842
sure, hoping it would learn that the formula was akin to [ethnicity|group] [activity|industry|thing] [social messaging medium] or however complex it is
>>
>>61001869
actually this is the Sudanese stormchasing subsection
>>
>>61001950
woah the things you learn on an alaskan moosemeat blackmarket documentary
>>
File: taking care of business.jpg (21KB, 450x300px) Image search: [Google]
taking care of business.jpg
21KB, 450x300px
>>61001869
I thought this was a Mongolian Croat-waxing tabloid.
>>
>>61001639
Good work OP. Also nice korbo
>>
>>61001639
>using C
it's a one-liner in python
>>
>>61002738
well that's just no fun
>>
>>61001639
how... how did you learn to program such complicated algorithms?! are you some kind of genius???
>>
>>61001639
>What do you think?

>unused includes
>global variables
>global variables passed as arguments with the same name
>constants are neither const nor #defines
>all caps identifiers that are not #defines
>inconsistent placement of asterisks in pointer definitions
I think you have lots of work to do.
>>
not op here, rate my python version

import random

f0 = "adjectives.txt"
f1 = "actions.txt"
f2 = "areas.txt"

listOne = []
listTwo = []
listThree = []

filename = [f0,f1,f2]
list = [listOne, listTwo, listThree]
listNum = [0]*3

for i in range(0,3):
with open(filename[i]) as infile:
list[i] = infile.readlines()
list[i] = [x.strip() for x in list[i]]

numGen = input("Generate how many names? ")
print "Generating ", numGen, "names."

for j in range(0,numGen):
for i in range(0,3):
listNum[i] = random.randrange(0,len(list[i]))
assert (0 <= listNum[i] <= len(list[i]))
print list[i][listNum[i]],
print

>>
File: 2017-06-21 15_24_18-.jpg (24KB, 929x372px) Image search: [Google]
2017-06-21 15_24_18-.jpg
24KB, 929x372px
>>61001639
why do you have three other repositories that are basically empty?

public class thing{
public static void main(String[] args){
System.out.println ("This is a string.");
}
}
>>
File: 0004460002509_A.jpg (21KB, 380x380px) Image search: [Google]
0004460002509_A.jpg
21KB, 380x380px
>>61001910
>on 4chan
>over 30
>>
>>61003340
>you don't need listOne-Three use [[]] * 3 instead
>if you want extra variables for each filename is debatable
>why is there an assert?
>you don't need a list for listNum if you just use it in the same block
>>
>>61001639
Good, now make a shit post generator.
>>
>>61003452
damn that helps a lot, thanks
the extra variables for the filenames was in to make it clearer in case you changed filenames manually, but I guess its still clear without that anyway
the assert was because I havent used the random range generator before and I didnt trust it

how does this look now?

import random

filename = ["adjectives.txt","actions.txt","areas.txt"]
list = [[]]*3

for i in range(0,3):
with open(filename[i]) as infile:
list[i] = infile.readlines()
list[i] = [x.strip() for x in list[i]]

numGen = input("Generate how many names? ")
print "Generating", numGen, "names."

for j in range(0,numGen):
for i in range(0,3):
listNum = random.randrange(0,len(list[i]))
print list[i][listNum],
print


does anyone know why printing
numGen = input()
print 'text', numGen, 'text'

includes spaces around the input number automatically?
is it just a feature? I would have imagined it wouldnt do that
>>
File: 7a5.gif (29KB, 482x800px) Image search: [Google]
7a5.gif
29KB, 482x800px
>>61003526
Looks pretty gud! You can take a look at random.choice() which would make the code a bit tidier and then maybe reduce the inner loop with a list comprehension
>>
>>61003665
got it down to this:

import random

filename = ["adjectives.txt","actions.txt","areas.txt"]
list = [[]]*3

for i in range(0,3):
with open(filename[i]) as infile:
list[i] = infile.readlines()
list[i] = [x.strip() for x in list[i]]

numGen = input("Generate how many names? ")
print "Generating", numGen, "names."

for j in range(0,numGen):
for i in range(0,3):
print random.choice(list[i]),
print


I'm not understanding how list comprehension can reduce it further though

is this the type of thing you meant by list comprehension?
    p = [random.choice(list[i]) for i in range(0,3)]
print p,
>>
>>61003823
not the one you answer to but probably meant replacing

    for i in range(0,3):
print random.choice(list[i]),
print


with

    print ' '.join(random.choice(list[i]) for i in range(0,3))


some other notes as it seems you're coming from another lang

you can do range(x) instead of range(0,x)
you can use a for loop over a list of items
you don't have to initiate the list, you can append
don't use list as variable name (it is also the name of a built-in function)
use dict instead of list for immutable such as the filename list
>>
>>61004371
thanks friend, I'll look into working those in too
I do electrical engineering and the most we ever realistically use is a small amount of matlab but I've been trying to expand a bit by myself as a side hobby
>>
>>61001639
>https://github.com/JaxonSkye/chan.git

>rand()

https://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers/
>>
>>61001639

Seriously though this is something I've always struggled with.

LINE_LEN is hard coded. And that's fine if the OP write all the .txt files and knows the smallest safe value. But what happens when someone adds a 60 character adjective?

All these memes about "safe" C involve reading the right amount of characters but there's no sane way to make this code work when it's not assigned to one variable.

How would you make this extensible?
>>
>>61004677
can you give me a small idiots rundown on why urandom might be better than rand()?

is it just safer?
>>
>>61004677
because this is such a security-critical application, right? We wouldn't want random numbers that might be statistically random but not cryptographically secure on our Argentinian origami forum.
>>
You're supposed to use alliteration and something that vaguely describes visual art, you flaming faggots.

Chinese cartoons
Taiwanese tapestry
Cantonese cave paintings
Etc
>>
>>61001639
But you can do this in google spreadsheet.
>>
>>61004820
>complaining about improper usage of memes on a Kuwaiti Badminton website
>>
>>61004371
>dict
meant tuple
>>
Your shtty code doesn't compile properly, just prints out the contents of one of the files
>>
>>61003823
>overwriting builtins
you deserve to die tbqh
>>
>>61001639
import random
import pyperclip

filenames = ['actions.txt', 'adjectives.txt', 'areas.txt']

output = []
for f in filenames:
with open(f, 'r') as input_file:
w = random.choice([x.strip() for x in input_file.readlines()])
output.append(w)

output = ' '.join(output)
pyperclip.copy(output)

print output



copies the string to clipboard for maximum shitposting efficiency
>>
File: 12506712.jpg (20KB, 331x315px) Image search: [Google]
12506712.jpg
20KB, 331x315px
>>61001639
>Serbian AMD repository
>>
>>61005702
sorry friendo
>>
File: intelligence_bellow_average.png (274KB, 318x397px) Image search: [Google]
intelligence_bellow_average.png
274KB, 318x397px
>>61001639
Make a site, faggot. It's not that hard.
>>
>>61005922
>paying money so that a total of 6 people can shitpost more
>>
>>61001639
>Japanese Thinkpad Forum
/tpg/... I...
>>
Basque Tie Knitting Community
French Canadian NEET Culture Sorority
Filippine Contrabass Enthusiasts Board
Chinese Dog Breeding Deep Web Drug Marketplace
Basque Astrology Subreddit
>>
Please don't play with our naturally occurring memes and shitposting. This is Reddit shit.
>>
Gonna make a website out of this and put lots of ads on it thanks OP
>>
>>61004820
I've heard Ukrainian Bear-skinning Forum before
>>
>>61006239
Finally, someone with gumption.
>>
>>61006239
<he thinks that people on an Etruscan Closed Captioning Server aren't all using adblockers
I have your website aliased under 'meme' rite now
>>
>>61002738
I wanted something that could run without depending on anything else being installed
>>61003057
Yeah kinda just threw things together until it worked
>>61003404
If you decide the hidden message in the names of the repos, moot appears and turns you into a little girl
>>61005922
>>61006049
I think tumblr can make a free site with this/basically this on it, but I don't really want to mess with tumblr that much
>>
File: 1304432226655.jpg (42KB, 300x332px) Image search: [Google]
1304432226655.jpg
42KB, 300x332px
>>61006049
>not already having a server and domain
sure is summer in here
>>
>>61001639
>2017
>posting babbys first code on a coptic amd onion node
Thread posts: 54
Thread images: 8


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.