Author Topic: Programming Megathread  (Read 143818 times)

swift is a bitch to work with cause xcode is such a stuffty program



ill move all my stolen programmer jokes here

Why did the double drown?

It was too big to float.

01000011 01100001 01101110 00100000 01111001 01101111 01110101 00100000 01100011 01101111 01100100 01100101 00100000 01101100 01101001 01101011 01100101 00100000 01110100 01101000 01101001 01110011 00111111 00001010 00001010 00001010 00001010

Talk("Can you code like this?");

Talk("I thought so.");
« Last Edit: October 28, 2015, 10:03:43 PM by Meta_KnightX »

01000011 01100001 01101110 00100000 01111001 01101111 01110101 00100000 01100011 01101111 01100100 01100101 00100000 01101100 01101001 01101011 01100101 00100000 01110100 01101000 01101001 01110011 00111111 00001010 00001010 00001010 00001010
Thats not coding
Thats just Binary




I prefer this kind of style

function helloWorld () {
    console.log('UGH');
}


to the examples you have in the OP
but it does depend on the language. in C or C++ I probably wouldn't stick the space between the function name and the (empty) argument list
however. I would NEVER put a space there in a function call because that is the most hideous thing in the entire planet earth

also your python example is python 2 (vomit)
replace it with this pls

print('Hello world!')

thought I was the only one who thought this haha


Code: [Select]
function Riddlerdidnothingwrong()
wrong = math.random(0,1) --lets set a random value
if wrong == 1 then --if the value is 1 then he did something wrong
print("he did something wrong")
end
if wrong == 0 then --vice versa
print("he did nothing wrong, he had the wrong people")
end
end --close the function

While wait(0.1) do --loop forever while not crashing the whole damn game.
print("Let us check his illegal status")
Riddlerdidnothingwrong() --calls the above function.
end --close the loop

Talk("Can you code like this?");
Talk("I thought so.");
def post():
    stuff_to_say = ['every', 'post', 'I', 'make', 'in', 'this', 'thread',
                    'from', 'now', 'on', 'will', 'be', 'in', 'python']
    return ' '.join(stuff_to_say)

print(post())

jk

ok FIRST off code tags are nasty
second where did all the whitespace go??

add haskell or I'll be sad

here's some basic Java code from one of my games that i made about 2.5 years ago.

if it's too long, tell me and i'll edit it down.

Code: [Select]
public void updateBuffer() {
buffer.height = body.height;
buffer.width = body.width;
if (isJump) {
if (direction == 0)
buffer.x = body.x - 20;
else
buffer.x = body.x + 20;
} else {
if (direction == 0)
buffer.x = body.x - 10;
else
buffer.x = body.x + 10;
}
}

public void move(walls w) {
if (!isFalling()) {
body.x += xVelocity;
if (xVelocity > 0) {
xVelocity += 2;
} else if (xVelocity < 0) {
xVelocity -= 2;
}

updateBuffer();

if (!isJump) {
boolean safe = false;
for (Rectangle a : w.getList()) {
if (buffer.intersects(a)) {
safe = true;
break;
}
}
if (!safe) {
dead = true;
if (direction == 0)
xVelocity += 2;
else
xVelocity -= 2;
}
} else {
for (Rectangle a : w.getList()) {
if (a.intersects(buffer)) {
if (direction == 1)
body.x += (a.x - body.x - 10);
else
body.x -= (body.x - a.x - 20);
stop();
break;
}
}
}
} else {
if (direction == 1) {
if (xVelocity > 0)
xVelocity -= 4;
else if (xVelocity < -2)
xVelocity = 0;
} else {
if (xVelocity < 0)
xVelocity += 4;
else if (xVelocity > 2)
xVelocity = 0;
}
body.x += xVelocity;

if (yVelocity == 0)
yVelocity += 9;
else
yVelocity += 4;
body.y += yVelocity;
if (body.y > 380) {
body.width = 20;
body.height = 10;
body.y = 380;
}
}
}

bonus points if you can kind of figure out what it's supposed to do