Monp
Level 0
|
|
« Reply #20 on: February 28, 2011, 04:18:57 AM » |
|
I had a friend looking over some code I had written late one night and it came out. if self.boss.hp <=0: self.boss.isdead = True if self.boss.isdead == True: self.boss.kill()
He messages me back saying not only do you kill your boss, you go back to check on it and kill it again for good measure. I couldn't help but laugh whenever he mentioned that.
|
|
|
Logged
|
|
|
|
dantheman363
|
|
« Reply #21 on: March 03, 2011, 01:46:36 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. Haha, double rainbow.
|
|
|
Logged
|
|
|
|
Zaknafein
|
|
« Reply #22 on: March 03, 2011, 01:51:08 PM » |
|
Mistyping "bool" as "cool" is always a laugh. (cooleans in java are pretty awesome too)
|
|
|
Logged
|
|
|
|
sublinimal
|
|
« Reply #23 on: March 03, 2011, 02:27:19 PM » |
|
I was making a black jack clone with an AI player that comments on the game. While exploring the jungle of non-mutually-exclusive conditions: AI hits! AI hits! AI busts! AI: I'm fine with this hand.
|
|
|
Logged
|
|
|
|
Pemanent
|
|
« Reply #24 on: March 03, 2011, 11:01:53 PM » |
|
I don't as often laugh at my code because of logs or debug info but I have some pretty cryptic comments. Although the days after late night coding I often laugh at the hackyness.
|
|
|
Logged
|
|
|
|
eclectocrat
|
|
« Reply #25 on: March 08, 2011, 03:07:51 AM » |
|
// Find the four corners. const sf::Vector2f TOP_LEFT (position.x - std::cos(degToRad(rotation)) * (tank.getSFMLImage()->GetWidth() / 2.f) - std::sin(degToRad(rotation)) * (tank.getSFMLImage()->GetHeight() / 2.f), position.y + std::sin(degToRad(rotation)) * (tank.getSFMLImage()->GetWidth() / 2.f) - std::cos(degToRad(rotation)) * (tank.getSFMLImage()->GetHeight() / 2.f)), TOP_RIGHT (position.x + std::cos(degToRad(rotation)) * (tank.getSFMLImage()->GetWidth() / 2.f) - std::sin(degToRad(rotation)) * (tank.getSFMLImage()->GetHeight() / 2.f), position.y - std::sin(degToRad(rotation)) * (tank.getSFMLImage()->GetWidth() / 2.f) - std::cos(degToRad(rotation)) * (tank.getSFMLImage()->GetHeight() / 2.f)), BOTTOM_LEFT (position.x - std::cos(degToRad(rotation)) * (tank.getSFMLImage()->GetWidth() / 2.f) + std::sin(degToRad(rotation)) * (tank.getSFMLImage()->GetHeight() / 2.f), position.y + std::sin(degToRad(rotation)) * (tank.getSFMLImage()->GetWidth() / 2.f) + std::cos(degToRad(rotation)) * (tank.getSFMLImage()->GetHeight() / 2.f)), BOTTOM_RIGHT(position.x + std::cos(degToRad(rotation)) * (tank.getSFMLImage()->GetWidth() / 2.f) + std::sin(degToRad(rotation)) * (tank.getSFMLImage()->GetHeight() / 2.f), position.y - std::sin(degToRad(rotation)) * (tank.getSFMLImage()->GetWidth() / 2.f) + std::cos(degToRad(rotation)) * (tank.getSFMLImage()->GetHeight() / 2.f));
// Find the corners of the other fixture. const float HOUSE_LEFT (otherFixture->GetBody()->GetPosition().x * GameManager::getRatio() + dynamic_cast<b2PolygonShape *>(otherFixture->GetShape())->GetVertex(0).x * GameManager::getRatio()), HOUSE_TOP (otherFixture->GetBody()->GetPosition().y * GameManager::getRatio() + dynamic_cast<b2PolygonShape *>(otherFixture->GetShape())->GetVertex(0).y * GameManager::getRatio()), HOUSE_RIGHT (otherFixture->GetBody()->GetPosition().x * GameManager::getRatio() + dynamic_cast<b2PolygonShape *>(otherFixture->GetShape())->GetVertex(2).x * GameManager::getRatio()), HOUSE_BOTTOM(otherFixture->GetBody()->GetPosition().y * GameManager::getRatio() + dynamic_cast<b2PolygonShape *>(otherFixture->GetShape())->GetVertex(2).y * GameManager::getRatio());
float x1(std::min(std::min(std::min(TOP_LEFT.x,TOP_RIGHT.x),BOTTOM_LEFT.x),BOTTOM_RIGHT.x)), y1(std::min(std::min(std::min(TOP_LEFT.y,TOP_RIGHT.y),BOTTOM_LEFT.y),BOTTOM_RIGHT.y)), x2(std::max(std::max(std::max(TOP_LEFT.x,TOP_RIGHT.x),BOTTOM_LEFT.x),BOTTOM_RIGHT.x)), y2(std::max(std::max(std::max(TOP_LEFT.y,TOP_RIGHT.y),BOTTOM_LEFT.y),BOTTOM_RIGHT.y)); Don't ask. Just wondering, why don't you import namespace std into some local file/function scope? Looking at all those std::'s makes me dizzy...
|
|
|
Logged
|
|
|
|
Evan Balster
|
|
« Reply #26 on: March 08, 2011, 05:07:23 AM » |
|
MUST RESIST URGE TO-- float w = (tank.getSFMLImage()->GetWidth() / 2.f), h = (tank.getSFMLImage()->GetHeight() / 2.f), c = std::cos(degToRad(rotation)), s = std::sin(degToRad(rotation)) const sf::Vector2f TOP_LEFT (position.x - c*w - s*h, position.y + s*w - c*h), TOP_RIGHT (position.x + c*w - s*h, position.y - s*w - c*h), BOTTOM_LEFT (position.x - c*w + s*h, position.y + s*w + c*h), BOTTOM_RIGHT (position.x + c*w + s*h, position.y - s*w + c*h);
//NO, STOP.
|
|
|
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>
|
|
|
Sos
|
|
« Reply #27 on: March 08, 2011, 10:07:01 AM » |
|
void stop_moving_walls() { oh_no_moving_walls_help=0; }
|
|
|
Logged
|
|
|
|
Tycho Brahe
|
|
« Reply #28 on: March 08, 2011, 02:21:35 PM » |
|
not technically my code, but I got a chuckle reading the google c++ style guide: You're not really going to define a macro, are you? If you do, they're like this: MY_MACRO_THAT_SCARES_SMALL_CHILDREN.
|
|
|
Logged
|
|
|
|
Riley Adams
|
|
« Reply #29 on: March 08, 2011, 05:25:53 PM » |
|
I accidentally created a recursive template monstrosity that resulted in the compiler spitting out an error message with hundreds of lines of angle brackets... (I literally had to scroll through several screens of pure >'s).
|
|
|
Logged
|
|
|
|
bengrue
|
|
« Reply #30 on: March 08, 2011, 11:38:50 PM » |
|
From a game project in 2002 (Hero Rancher! Capture wild heroes, breed them, and make them fight other teams!)
int D = 8;
while( 8==D ) { ///...do stuff, omitted... if( battle_done() ) { D = 0; } }
I am no less mature now than I was 10 years ago ;(
|
|
|
Logged
|
|
|
|
Belimoth
|
|
« Reply #31 on: March 10, 2011, 08:11:39 AM » |
|
Was reviewing some old code where there were three factions(each with a corresponding castle) being declared. Global Red_Faction:TFaction = TFaction.Create(255, 0, 0) Global Red_Castle:TCastle = TCastle.Create(Red_Faction, True)
Global Blu_Faction:TFaction = TFaction.Create(0, 0, 255) Global Blu_Castle:TCastle = TCastle.Create(Blu_Faction, True)
Global Neu_Faction:TFaction = TFaction.Create(128, 128, 128) Global Neuschwanstein:TCastle = TCastle.Create(Neu_Faction, True)
Up until then I had been assuming it was called "Neu_Castle." I am thankful for the ability to find-and-replace.
|
|
|
Logged
|
|
|
|
Zaknafein
|
|
« Reply #32 on: March 10, 2011, 09:01:50 AM » |
|
I am no less mature now than I was 10 years ago ;(
Apparently neither am I. Hilarious.
|
|
|
Logged
|
|
|
|
sublinimal
|
|
« Reply #33 on: March 10, 2011, 09:20:00 AM » |
|
nihi = []
def leppard(): ...
Eheh.
|
|
|
Logged
|
|
|
|
Taiko
|
|
« Reply #34 on: March 10, 2011, 01:01:58 PM » |
|
Am I the only one who puts terribly stupid things as print statements to help me catch bugs?
|
|
|
Logged
|
|
|
|
MeshGearFox
|
|
« Reply #35 on: March 10, 2011, 01:37:22 PM » |
|
I have a bad habit of:
A) Not updating my comments. B) Copying comments over with other block of code but not changing them to be relevant.
As a result I get things like
// Max room height -- should always be set to 30. const int max_room_height = 32;
or
// Test if the value passed in from Lua is a number if(!lua_isstring(...)) {}
|
|
|
Logged
|
|
|
|
J. Kyle Pittman
|
|
« Reply #36 on: March 11, 2011, 09:45:39 AM » |
|
Am I the only one who puts terribly stupid things as print statements to help me catch bugs?
I do this all the time. printf("################### HURR DURR derpderpderp!!!1");
|
|
|
Logged
|
|
|
|
Eibx
|
|
« Reply #37 on: March 11, 2011, 10:56:34 AM » |
|
My late night code consists of bool isDead = true;
if (isDead == true) { return true; } else { return false; }
|
|
|
Logged
|
"You need to be logged in to log out. Please log in to log out."
|
|
|
kumacmon
|
|
« Reply #38 on: March 11, 2011, 02:42:43 PM » |
|
At work, the majority of my print/trace statements are "fuuuuuuu work damnit" or "butts go here". I might as well be 12. There have been a few times that I've submitted code in by accident that would spam the log with things like that so, I'm slowly learning to use more "professional" expressions. Came across a line in someone else's code the other day that out of context made me laugh: if(!_names[i].inUse) { stupid = true; break; }
|
|
|
Logged
|
|
|
|
rivon
|
|
« Reply #39 on: March 12, 2011, 03:51:11 AM » |
|
My log: fu bla bla bla foo foo foo suck foo wtf bitch
|
|
|
Logged
|
|
|
|
|