Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411703 Posts in 69399 Topics- by 58455 Members - Latest Member: roeyskatt

May 19, 2024, 10:27:53 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Post if you just laughed at your code.
Pages: 1 ... 4 5 [6] 7 8 ... 27
Print
Author Topic: Post if you just laughed at your code.  (Read 86784 times)
drChengele
Level 2
**


if (status = UNDER_ATTACK) launch_nukes();


View Profile
« Reply #100 on: September 02, 2011, 02:49:33 PM »

Not really code but a changelog, I think it qualifies.
Code:
- Split off blueprints from archetypes. Finally blueprints can be targeted by modifiers \o/
- Just remembered I haven't coded in modifiers yet FFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUU
Logged

Praetor
Currently working on : tactical battles.
zamp
Level 1
*



View Profile
« Reply #101 on: September 05, 2011, 01:51:25 PM »

Code:
throw Error("Holy shit");
Big Laff
Logged
Ishi
Pixelhead
Level 10
******


coffee&coding


View Profile WWW
« Reply #102 on: September 05, 2011, 03:12:53 PM »

I found a comment at the top of a file that I wrote about a year ago and then forgot about.

Code:
// cEasyMenu
// "It really takes the misery out of making menus"

also, this is the best magic number ever created apparently:
Quote
Code:
i  = 0x5f3759df - ( i >> 1 );               // what the fuck?

http://en.wikipedia.org/wiki/Fast_inverse_square_root

That was fun to skim through.
Logged

Noyb
Level 9
****



View Profile WWW
« Reply #103 on: September 05, 2011, 03:25:29 PM »

Not my code, but the xv6 teaching operating system's code contains lines like
Code:
panic("zombie exit");

(referring of course to zombie processes and not an unintended breach in undead containment protocols)
Logged

J. Kyle Pittman
Level 6
*


PostCount++;


View Profile WWW
« Reply #104 on: September 12, 2011, 09:21:42 PM »

Code:
DoThisEveryTimeBecauseImDumb.loadBMP("map_tiles.bmp");
Logged

ChevyRay
Guest
« Reply #105 on: September 12, 2011, 10:47:41 PM »

Had this sitting in my code forever before I noticed it, heh.

Code:
Scene girl = new SceneGirl();

Logged
Aynslei
Level 0
*


View Profile
« Reply #106 on: September 23, 2011, 02:45:18 PM »

I wanted a simple way to show the first year kids how to check if a section of code has run once before.......

boolean firstTime = true;

Which would later be turned into.

firstTime = false;

I am so bad.
Logged

\"All things are born, and all things die. It is left to us to decide what we make of them.\" - Aynslei
ChevyRay
Guest
« Reply #107 on: September 23, 2011, 04:44:07 PM »

Haha that is beautiful.
Logged
Hangedman
Level 10
*****


Two milkmen go comedy


View Profile WWW
« Reply #108 on: September 23, 2011, 06:56:12 PM »

now that's some nice 'spaghetti logic'  Coffee Hand Thumbs Up Right
Logged

AUST
ITIAMOSIWE (Play it on NG!) - Vision
There but for the grace of unfathomably complex math go I
eclectocrat
Level 5
*****


Most of your personality is unconscious.


View Profile
« Reply #109 on: September 24, 2011, 12:30:21 AM »

Code:
self.help = Book()
Logged

I make Mysterious Castle, a Tactics-Roguelike
ThemsAllTook
Administrator
Level 10
******



View Profile WWW
« Reply #110 on: September 25, 2011, 09:05:34 AM »

Not quite code, but closely related: I was having trouble finding the right word for something, so I looked it up in a thesaurus...before I realized how ridiculous it was to do that for something that was going into an svn commit message. Which has a vanishingly small chance of ever being read again.
Logged

J-Snake
Level 10
*****


A fool with a tool is still a fool.


View Profile WWW
« Reply #111 on: September 25, 2011, 09:25:19 AM »

Here's another marvel from my side, including extremely long, nested expressions, magical numbers and the same values calculated more than once, and other stuff. Hey, I just wanted to make sure that it actually worked, before I, possibly, wasted time on making it pretty!



Did it work? Yes! Coffee
Wow, I wish the code of my first game 10 years ago would be that nicely structured. ASM-spaghetti deluxe!
Logged

Independent game developer with an elaborate focus on interesting gameplay, rewarding depth of play and technical quality.<br /><br />Trap Them: http://store.steampowered.com/app/375930
Dan Cardin
Level 0
**


Man Flardin?


View Profile
« Reply #112 on: September 26, 2011, 07:53:03 AM »

I only ever laugh at my code when it works the first time i run it.
Logged
mokesmoe
Level 10
*****



View Profile WWW
« Reply #113 on: September 26, 2011, 08:43:43 AM »

Not really code, but I managed to upload a build of a game that crashed when you died because I completely forgot to code the death. (I was good at playing it from testing so I never noticed.)
Logged
Mikademus
Level 10
*****


The Magical Owl


View Profile
« Reply #114 on: September 26, 2011, 10:57:07 AM »

Code:
static sf::Shape *pERect;

Fyi, the 'E' is the typo.
Logged

\\\"There\\\'s a tendency among the press to attribute the creation of a game to a single person,\\\" says Warren Spector, creator of Thief and Deus Ex. --IGN<br />My compilation of game engines for indies
Sakar
Guest
« Reply #115 on: September 30, 2011, 11:17:38 AM »

Code:
	void Entity::draw()
{
glPushMatrix();
glTranslatef(x, y, 0);
glRotatef(rot, 0, 0, 1);
glScalef(scale, scale, scale);

glColor3ub(color.getRed(), color.getGreen(), color.getBlue());
if(graphic == NULL) 
glBindTexture(GL_TEXTURE_2D, 0);
else
glBindTexture(GL_TEXTURE_2D, graphic->getId());
Spritemap* sm = static_cast<Spritemap*>(graphic);
glBegin(GL_QUADS);
if(typeid(graphic).name() == "Texture*")
glTexCoord2i(0, 1);
else
glTexCoord2f(sm->getFrame().x, sm->getFrame().h);
glVertex2i(-width/2, height/2);

if(typeid(graphic).name() == "Texture*")
glTexCoord2i(1, 1);
else
glTexCoord2f(sm->getFrame().w, sm->getFrame().h);
glVertex2i( width/2, height/2);

if(typeid(graphic).name() == "Texture*")
glTexCoord2i(1, 0);
else
glTexCoord2f(sm->getFrame().w, sm->getFrame().y);
glVertex2i( width/2, -height/2);

if(typeid(graphic).name() == "Texture*")
glTexCoord2i(0, 0);
else
glTexCoord2f(sm->getFrame().x, sm->getFrame().y);
glVertex2i(-width/2, -height/2);
glEnd();
glPopMatrix();
}
I...just no
Logged
roboprez
Level 1
*


Got to love them pixels


View Profile WWW
« Reply #116 on: October 14, 2011, 01:58:21 AM »

I was looking back on some random level generation code I had made and I found this.
Code:
if (CAPCOM == 0) {
if(tunnels[cT].dir==0){
height = rand(rSizeMin, rSizeMax)
(... more code)

Wait CAPCOM?  Undecided

Code:
}else if (CAPCOM == 1 ||CAPCOM == 2)
//Put on another corridor
{
var randN:int = new int()
var tunnelDir:int = new int()
if (tunnels[cT].dir == 0) {
randN = rand(0, 1)
width = rand(tWidthMin, tWidthMax)
(blah blah blah)

 Huh?

After a good half hour I worked out that CAPCOM was the result of a dice roll that chooses how many kinks the corridors have.  Shocked

And I called it CAPCOM...
Logged

mokesmoe
Level 10
*****



View Profile WWW
« Reply #117 on: December 10, 2011, 02:01:08 AM »

I had some functions inside functions, and it was really hard to read what part did what. Then I had an an idea, and this happened:
Code:
        motion_add
        (
            point_direction
            (
                x+(sprite_width/2),
                y+(sprite_width/2),
                other.x+(other.sprite_width/2),
                other.y+(other.sprite_height/2)
            ),
            (other.sprite_width*other.sprite_height*.8)/
            (
                point_distance
                (
                    x+8,
                    y+8,
                    other.x+(other.sprite_width/2),
                    other.y+(other.sprite_height/2)
                )
                *100
            )
        )

At least I can read it now.
Logged
rivon
Level 10
*****



View Profile
« Reply #118 on: December 10, 2011, 09:27:13 AM »

I don't get it. Also, is that Flash or GM? Or something else?
Logged
Mikademus
Level 10
*****


The Magical Owl


View Profile
« Reply #119 on: December 10, 2011, 09:54:01 AM »

I think motion_add is a function that takes the result of a number of calculation as parameters and that he used parentheses around them and indented the calculations as line code for readability.
Logged

\\\"There\\\'s a tendency among the press to attribute the creation of a game to a single person,\\\" says Warren Spector, creator of Thief and Deus Ex. --IGN<br />My compilation of game engines for indies
Pages: 1 ... 4 5 [6] 7 8 ... 27
Print
Jump to:  

Theme orange-lt created by panic