Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411280 Posts in 69323 Topics- by 58380 Members - Latest Member: bob1029

March 28, 2024, 06:23:34 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] 2 3 ... 27
Print
Author Topic: Post if you just laughed at your code.  (Read 85950 times)
Evan Balster
Level 10
*****


I live in this head.


View Profile WWW
« 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:

Quote
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
Level 10
*****


Two milkmen go comedy


View Profile WWW
« 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:

Quote
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

AUST
ITIAMOSIWE (Play it on NG!) - Vision
There but for the grace of unfathomably complex math go I
iffi
Guest
« Reply #2 on: February 17, 2011, 07:24:59 PM »

I was once bored enough to type this and laugh at it:
Code:
double rainbow;

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
Level 10
*****


I live in this head.


View Profile WWW
« Reply #3 on: February 17, 2011, 07:58:14 PM »

Code:
double rainbow;

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.  Wink
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
Level 10
*****


glitch


View Profile WWW
« 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:

Quote
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

My projects:<br />Games: Jumpman Retro-futuristic platforming iJumpman iPhone version Drumcircle PC+smartphone music toy<br />More: RUN HELLO
Riley Adams
Level 5
*****


I don't actually use Ubuntu much...


View Profile
« 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:

Quote
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... Facepalm

In other news lexicographical is fun to say. Durr...?
Logged

raigan
Level 5
*****


View Profile
« 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 Smiley
Logged
Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« 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.

Code:
declare
    Victory_Exception: exception;
begin
    raise Victory_Exception with "You win!";
end;
Logged



What would John Carmack do?
Triplefox
Level 9
****



View Profile WWW
« Reply #8 on: February 18, 2011, 09:12:12 PM »

Debug printouts.

Code:

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:

Code:
yo
yo
yo
yo
yo
yo
yo
yo
yo
yoyo
Logged

BlueSweatshirt
Level 10
*****

the void


View Profile WWW
« Reply #9 on: February 20, 2011, 01:27:56 AM »

I was implementing the various poses for my "Throw" animation of my character.

Quote
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.  Facepalm
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:
Code:
omg
OMG
omfg
OMG
omg
OMFG
omfg
omg
OMG
FUCKKKKKKKKKKKKKKK
OMMMGGGGGG
Logged
BlueSweatshirt
Level 10
*****

the void


View Profile WWW
« Reply #11 on: February 20, 2011, 01:57:36 AM »

Am I the only one who cleans up their logs?  Giggle

Apparently so...


Also: omgwtfhax 10 posts to level 10 what is this madness I need to gtfo TIGS.
Logged

mcc
Level 10
*****


glitch


View Profile WWW
« Reply #12 on: February 20, 2011, 02:30:49 AM »

I was implementing the various poses for my "Throw" animation of my character.

Quote
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.  Facepalm
Maybe this would make more sense as an array of four elements anyway.

Assuming that is not some kind of problem in Actionscript.
Logged

My projects:<br />Games: Jumpman Retro-futuristic platforming iJumpman iPhone version Drumcircle PC+smartphone music toy<br />More: RUN HELLO
Golds
Loves Juno
Level 10
*


Juno sucks


View Profile WWW
« Reply #13 on: February 20, 2011, 02:32:35 AM »

I prefer to cry at my code.
Logged

@doomlaser, mark johns
Riley Adams
Level 5
*****


I don't actually use Ubuntu much...


View Profile
« 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:
Code:
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
Level 10
*****

the void


View Profile WWW
« 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
Level 10
*****


I live in this head.


View Profile WWW
« 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

Code:
:) :) :) :) :) :| :( :( :(

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
Level 10
*****


glitch


View Profile WWW
« 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

My projects:<br />Games: Jumpman Retro-futuristic platforming iJumpman iPhone version Drumcircle PC+smartphone music toy<br />More: RUN HELLO
Klaim
Level 10
*****



View Profile WWW
« 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
Level 10
*****


I live in this head.


View Profile WWW
« 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>
Pages: [1] 2 3 ... 27
Print
Jump to:  

Theme orange-lt created by panic