[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
ITT: /g/ writes a program
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 27
Thread images: 3
https://codeshare.io/mQ8xm
>>
https://codeshare.io/CfxKq

new one some fag deleted it
>>
>>
>>52428735
>/g/
html isn't programming.
>>
>>52429608
Says you, scrub :^)
>>
File: alg-resize-mel-gibson-jpg.jpg (89 KB, 970x724) Image search: [Google]
alg-resize-mel-gibson-jpg.jpg
89 KB, 970x724
>>52429674
>thinks HTML documents are programs
>calls people scrub
>>
>>52429866
>thinks HTML documents aren't programs
>calls me people
:^)
>>
import std.stdio;

char[] DEEEEEE = ['D', 'E'];

int main() {
writef("%c", DEEEEEE[0]);
int i = 0;
while(i < 100000000000) {
writef("%c", DEEEEEE[1]);
i++; //solved the halting problem
}
writef("%s\n", "Z NUTS");
wakeMeUp();
return 0;
}

/* I like dicks */

void wakeMeUp()
{
writeln("CAN'T WAKE UP");
}

we're done
that'll be $10,000
>>
>>52430004
Needs GPL
>>
>>52430179
Needs WTFPL* there you go, fixxed
>>
My glorious game isn't going to write itself dudes.
>>
Come write some rooms for this epic adventure, in Python.
>>
>>52428735
>not using an editor with a built-in sandbox
>>
This is going much better then imagined.
>>
DID SOMEONE SAVE IT BEFORE IT GOT REKT?!

That was going very well to the point I was actually learning things.

Can the anon that made those dictionaries for directions, abbreviations, and then calling the functions post that here if you still have it?
>>
>>52430637
Until someone blanked the whole bloody thing.
>>
>>52430686
That was me. It's pretty simple, really, in Python a function is an object, so it can be moved around, stored, referenced, etc just like anything else. To call it, just use the () syntax.
>>
>>52430700
>>52430686
Here's an example:
def foo():
return "bar"

a = foo # a is the function foo
b = foo() # b is the value foo returns when called
c = a() # c is the same as b

some_functions = [sum, max, foo]

some_functions[0](1,2,3) # returns 6, because it calls sum
some_functions[1](1,2,3) # returns 3, because it calls max
some_functions[2]() # returns "bar", because it calls foo
>>
We could have had a magical adventure full of minature horses singing Coolio, black maids feeding you sweet tea, and golden rooms full of burgers but noooooooo.
>>
>>52430731
The rock serving a carafe of pizza would be fine too
>>
>>52430726

Excellent, thank you man.
>>
>>52430741

I agree. Anything would be find. It was just amazing it was coherent and still funny for a while there.
>>
/webdev/ coming in and shitting it up more.
>>
>>52430726
We can use this to accomplish some really interesting things.
def map(function, values):
return [function(v) for v in values] # This is called a "list comprehension" It's a shorter way of writing:
# output = []
# for v in values:
# output.append(v)
# return output

def plus_one(n):
return n + 1

map(plus_one, [1, 2, 3]) # returns [2, 3, 4]

def print_a_lot_of_stars(how_many_stars):
print "*"*how_many_stars # you can multiply a string by an integer to get that string repeated that many times

map(print_a_lot_of_stars, [1, 2, 3]) # returns None, but prints
# *
# **
# ***
>>
>>52430817
literally all me
>>
>>52430826
Crap, in the comment explaination of list comprehensions, that append line should read
output.append(function(v))


I can't proofread to save my life.
>>
someone post that ascii girl here pls
Thread replies: 27
Thread images: 3

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.