Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411512 Posts in 69376 Topics- by 58430 Members - Latest Member: Jesse Webb

April 26, 2024, 07:28:08 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 4 ... 27
Print
Author Topic: Post if you just laughed at your code.  (Read 86630 times)
Monp
Level 0
*


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



View Profile WWW
« Reply #21 on: March 03, 2011, 01:46:36 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.


Haha, double rainbow.
Logged

Zaknafein
Level 4
****



View Profile WWW
« Reply #22 on: March 03, 2011, 01:51:08 PM »

Mistyping "bool" as "cool" is always a laugh. Grin
(cooleans in java are pretty awesome too)
Logged

sublinimal
Level 8
***



View Profile
« 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. Durr...?
Logged
Pemanent
Level 4
****



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


Most of your personality is unconscious.


View Profile
« Reply #25 on: March 08, 2011, 03:07:51 AM »

Code:
			// 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

I make Mysterious Castle, a Tactics-Roguelike
Evan Balster
Level 10
*****


I live in this head.


View Profile WWW
« Reply #26 on: March 08, 2011, 05:07:23 AM »

MUST RESIST URGE TO--

Code:
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
Level 8
***


I make bad games


View Profile WWW
« Reply #27 on: March 08, 2011, 10:07:01 AM »

Code:
void stop_moving_walls()
{
oh_no_moving_walls_help=0;
}
Logged

Tycho Brahe
Level 10
*****

λx.x


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

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


I don't actually use Ubuntu much...


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


I code. A lot.


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

Current Project: Sully: A Very Serious RPG

Executive Producer of Dungeons of Dredmor

@bengrue on the twitternets
Belimoth
Level 10
*****


high-heeled cyberbully


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

Big Laff

Up until then I had been assuming it was called "Neu_Castle." I am thankful for the ability to find-and-replace.
Logged

Zaknafein
Level 4
****



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

sublinimal
Level 8
***



View Profile
« Reply #33 on: March 10, 2011, 09:20:00 AM »

Code: (Python)
nihi = []

def leppard():
    ...

Eheh.
Logged
Taiko
Level 2
**



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


When you have no one, no one can hurt you.


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


PostCount++;


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

Code:
printf("################### HURR DURR derpderpderp!!!1");
Logged

Eibx
Level 0
***


ヽ༼ ಠل͟ರೃ ༽ノ


View Profile
« Reply #37 on: March 11, 2011, 10:56:34 AM »

My late night code consists of

Code:
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
Level 0
*



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

Code:
if(!_names[i].inUse)
{
  stupid = true;
  break;
}
Logged
rivon
Level 10
*****



View Profile
« Reply #39 on: March 12, 2011, 03:51:11 AM »

My log:
Code:
fu
bla bla bla
foo
foo
foo
suck
foo
wtf
bitch
Smiley
Logged
Pages: 1 [2] 3 4 ... 27
Print
Jump to:  

Theme orange-lt created by panic