Evan Balster
|
|
« on: February 17, 2011, 07:20:08 PM » |
|
I can't be the only person nerdy enough to laugh at my own code on a regular basis. And frequently it's for a pretty good reason. So share your stupid programmer laughs, comment jokes and the like. Consider this a receptacle for all that code-humor. Just now: I need a buffer to store audio that's rendered but exceeds the output size. (Said audio is pushed to the next output block) -- So I come up with a variable name and laugh as soon as I type out the declaration: typedef std::vector<Uint8> Buffer; Buffer overrun;
|
|
|
Logged
|
Creativity births expression. Curiosity births exploration. Our work is as soil to these seeds; our art is what grows from them...Wreath, SoundSelf, Infinite Blank, Cave Story+, <plaid/audio>
|
|
|
Hangedman
|
|
« Reply #1 on: February 17, 2011, 07:24:04 PM » |
|
At the Dirty Rectangles hangout, I desperately tried to get my game into a showoffable state. Didn't end up showing it off, but I did frantically fix every bug. Of course, having been working on an essay today I didn't touch it, and went back to find not only the spaghettiest code full of crazy dependencies and ifs, but also my fantastic win message: public function Resolve3():void { if (Played1 == 44 || Played1 == 45) { P1Stats[3] += 3; var kill:int = 0; var blow:int = 0; for (var p:int = 1; p < 4; p += 1) { if (P1Stats[p-1] == 9) { kill = p; } } for (var q:int = 1; q < 4; q += 1) { if (P2Stats[q-1] == 0) { blow = q; } } if (kill != blow && kill != 0 && blow != 0) { GameOverBGvis = true; S1Text.text = "PLAYER 1 WINS\nAND I'M LAZY"; S2Text.text = ""; } } if (Played2 == 44 || Played2 == 45) { P2Stats[3] += 3; var kill2:int = 0; var blow2:int = 0; for (var pp:int = 1; pp < 4; pp += 1) { if (P2Stats[pp-1] == 9) { kill2 = pp; } } for (var qq:int = 1; qq < 4; qq += 1) { if (P1Stats[qq-1] == 0) { blow2 = qq; } } if (kill2 != blow2 && kill2 != 0 && blow2 != 0) { GameOverBGvis = true; S1Text.text = "PLAYER 2 WINS\nAND I'M LAZY"; S2Text.text = ""; } } if (GameOverBGvis = false) { KillingBlow = false; } }
|
|
|
Logged
|
|
|
|
iffi
Guest
|
|
« Reply #2 on: February 17, 2011, 07:24:59 PM » |
|
I was once bored enough to type this and laugh at it: I was also laughing like a mad scientist while finishing up my Java Tetris clone, at both the things that actually worked and the things that went horribly wrong.
|
|
|
Logged
|
|
|
|
Evan Balster
|
|
« Reply #3 on: February 17, 2011, 07:58:14 PM » |
|
This is exactly the sort of laugh I was hoping to get out of this thread. Not that Hangedman's code-copying klugefest isn't worth an empathetic giggle too.
|
|
|
Logged
|
Creativity births expression. Curiosity births exploration. Our work is as soil to these seeds; our art is what grows from them...Wreath, SoundSelf, Infinite Blank, Cave Story+, <plaid/audio>
|
|
|
mcc
|
|
« Reply #4 on: February 17, 2011, 08:12:42 PM » |
|
This time-travel shooter game I've been working on has been AWESOME. A couple days ago I found myself actually writing the function: void object_lifetime::remove_free_will(int at) { for(int c = 0; c < watch->spaces[at].shapes.size(); c++) watch->spaces[at].shapes[c]->group = GROUP_PREDESTINED; }
|
|
|
Logged
|
|
|
|
Riley Adams
|
|
« Reply #5 on: February 17, 2011, 08:29:57 PM » |
|
This is more just ugly code than funny, but it made me laugh... I was trying to compare a couple arrays of shorts with a lexicographical_compare, but for some reason the compiler wasn't finding "lexicographical_compare"... So I wound up doing this ugliness: return std::string(reinterpret_cast<const char*>(&c1.coords),sizeof(short)*3) < std::string(reinterpret_cast<const char*>(&c2.coords),sizeof(short)*3); Turned out I forgot to put the "std" in front of lexicographical_compare... In other news lexicographical is fun to say.
|
|
|
Logged
|
|
|
|
raigan
|
|
« Reply #6 on: February 17, 2011, 09:27:00 PM » |
|
nowhere near as good as double rainbow, but we have a mathutils class that is referred to as Matthew Tills
|
|
|
Logged
|
|
|
|
Average Software
|
|
« Reply #7 on: February 18, 2011, 06:41:13 AM » |
|
My first "implementation" of winning a map had my giggling for at least an hour. declare Victory_Exception: exception; begin raise Victory_Exception with "You win!"; end;
|
|
|
Logged
|
What would John Carmack do?
|
|
|
Triplefox
|
|
« Reply #8 on: February 18, 2011, 09:12:12 PM » |
|
Debug printouts. public static function onDeadCreep(deaddata : Dynamic) { trace("omg dead creep "+Std.string(deaddata)); var group = Entity.ids.get(deaddata.group); group.childrenCreeps.remove(deaddata.id); }
An old co-worker who was responsible for basically the entire engine we used had a habit of using "yo" for debug prints. Thus large amounts of logspam looked like this:
|
|
|
Logged
|
|
|
|
BlueSweatshirt
|
|
« Reply #9 on: February 20, 2011, 01:27:56 AM » |
|
I was implementing the various poses for my "Throw" animation of my character. private var Anim_ThrowDown:Spritemap; private var Anim_ThrowLeft:Spritemap; private var Anim_ThrowRight:Spritemap; private var Anim_ThrowUp:Spritemap;
I laughed then felt a little sick.
|
|
|
Logged
|
|
|
|
Glaiel-Gamer
Guest
|
|
« Reply #10 on: February 20, 2011, 01:51:08 AM » |
|
An old co-worker who was responsible for basically the entire engine we used had a habit of using "yo" for debug prints. Thus large amounts of logspam looked like this:
my logspam looks more like this: omg OMG omfg OMG omg OMFG omfg omg OMG FUCKKKKKKKKKKKKKKK OMMMGGGGGG
|
|
|
Logged
|
|
|
|
BlueSweatshirt
|
|
« Reply #11 on: February 20, 2011, 01:57:36 AM » |
|
Am I the only one who cleans up their logs? Apparently so... Also: omgwtfhax 10 posts to level 10 what is this madness I need to gtfo TIGS.
|
|
|
Logged
|
|
|
|
mcc
|
|
« Reply #12 on: February 20, 2011, 02:30:49 AM » |
|
I was implementing the various poses for my "Throw" animation of my character. private var Anim_ThrowDown:Spritemap; private var Anim_ThrowLeft:Spritemap; private var Anim_ThrowRight:Spritemap; private var Anim_ThrowUp:Spritemap;
I laughed then felt a little sick. Maybe this would make more sense as an array of four elements anyway. Assuming that is not some kind of problem in Actionscript.
|
|
|
Logged
|
|
|
|
Golds
Loves Juno
Level 10
Juno sucks
|
|
« Reply #13 on: February 20, 2011, 02:32:35 AM » |
|
I prefer to cry at my code.
|
|
|
Logged
|
|
|
|
Riley Adams
|
|
« Reply #14 on: February 20, 2011, 03:17:59 AM » |
|
An old co-worker who was responsible for basically the entire engine we used had a habit of using "yo" for debug prints. Thus large amounts of logspam looked like this:
my logspam looks more like this: omg OMG omfg OMG omg OMFG omfg omg OMG FUCKKKKKKKKKKKKKKK OMMMGGGGGG
That looks familiar... (though lately, I use "dubyah tee eff" a lot for some reason...) I'm always a little afraid when I open source things that I left one or two of them commented out somewhere...
|
|
|
Logged
|
|
|
|
BlueSweatshirt
|
|
« Reply #15 on: February 20, 2011, 11:29:53 AM » |
|
Maybe this would make more sense as an array of four elements anyway.
Assuming that is not some kind of problem in Actionscript.
I have the original variables, and then I throw them into an array afterwards. There's not a real *reason* for me to do that, it's just something I've done since I started working on my game so I keep to the same pattern.
|
|
|
Logged
|
|
|
|
Evan Balster
|
|
« Reply #16 on: February 20, 2011, 11:46:41 AM » |
|
The closest I've gotten to the "omg" thing (that I can think of) was using happy faces for an OGG decoder. They go :) :) :) :) :) :| :( :( :( with the expression drooping when the thing breaks.
|
|
|
Logged
|
Creativity births expression. Curiosity births exploration. Our work is as soil to these seeds; our art is what grows from them...Wreath, SoundSelf, Infinite Blank, Cave Story+, <plaid/audio>
|
|
|
mcc
|
|
« Reply #17 on: February 20, 2011, 12:34:10 PM » |
|
Maybe this would make more sense as an array of four elements anyway.
Assuming that is not some kind of problem in Actionscript.
I have the original variables, and then I throw them into an array afterwards. There's not a real *reason* for me to do that, it's just something I've done since I started working on my game so I keep to the same pattern. That sounds sensible to me.
|
|
|
Logged
|
|
|
|
Klaim
|
|
« Reply #18 on: February 20, 2011, 02:16:10 PM » |
|
Trying to work around limitations/design flaws (in my view at least) in XSD format. Fucking inheritance-that-is-not-really-one.
|
|
|
Logged
|
|
|
|
Evan Balster
|
|
« Reply #19 on: February 20, 2011, 04:15:45 PM » |
|
So I'm making a high-performance audio mixer, and I use a buffer of higher-precision values during the mixing op, and I want no floating point math per-sample. So I figure I'll set a certain acceptable number of bits to be used for quantized volume scaling and do it with integer multiplication.
So I use the name 'volbits'. And it's adorable.
I want to name my next small-cute-animal-type-thing "volbits".
|
|
|
Logged
|
Creativity births expression. Curiosity births exploration. Our work is as soil to these seeds; our art is what grows from them...Wreath, SoundSelf, Infinite Blank, Cave Story+, <plaid/audio>
|
|
|
|