Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411630 Posts in 69393 Topics- by 58447 Members - Latest Member: sinsofsven

May 12, 2024, 02:57:16 AM

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 ... 3 4 [5] 6 7 ... 27
Print
Author Topic: Post if you just laughed at your code.  (Read 86751 times)
Hangedman
Level 10
*****


Two milkmen go comedy


View Profile WWW
« Reply #80 on: June 08, 2011, 05:22:59 PM »

Can't help but wonder if I could have condensed this better:

Code:
if (!dead && !rolling && touchdown && dir == 1 && speed.y > 0 && collide("Hanger", x + 1, y - 1) && !collide("Hanger", x, y) && !collide("Hanger", x + 1, y) && !collide("Wall", x, y + 3)) { hanging = true; }
if (!dead && !rolling && touchdown && dir == 0 && speed.y > 0 && collide("Hanger", x - 1, y - 1) && !collide("Hanger", x, y) && !collide("Hanger", x - 1, y) && !collide("Wall", x, y + 3)) { hanging = true; }
Logged

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

Fleeing all W'rkncacnter


View Profile WWW
« Reply #81 on: June 08, 2011, 07:11:27 PM »

I don't ever I've ever written something that looked this ridiculous, but I swear it makes sense in context:

Code:
    procedure Process_Lunch(Object: in out State) is
    begin
        if not Object.Map.Is_Moving then
            Object.Current_State := Lunching;

            declare
                Text: constant String := "Lunch Break!";
                Effect: Message_Effect;
            begin
                case Unit_Owner(Object.Current_Game, Object.Unit_Start_Location) is
                    when Red =>
                        Effect := Message_Effect_With_Text(Text,
                                                           Red => 1.0, Green => 0.0, Blue => 0.0);
                    when Green =>
                        Effect := Message_Effect_With_Text(Text,
                                                           Red => 0.0, Green => 1.0, Blue => 0.0);
                    when Yellow =>
                        Effect := Message_Effect_With_Text(Text,
                                                           Red => 1.0, Green => 1.0, Blue => 0.0);
                    when Blue =>
                        Effect := Message_Effect_With_Text(Text,
                                                           Red => 0.0, Green => 0.0, Blue => 1.0);
                end case;
           
                Effect.Set_Hex(Object.Unit_Start_Location);
                Object.Effects.Add_Effect(Effect);
                Object.Unit_Start_Location := No_Location;
            end;
        end if;
    end Process_Lunch;

I now have code that can process lunch.
Logged



What would John Carmack do?
Elliott D.
Level 0
***



View Profile WWW
« Reply #82 on: June 14, 2011, 06:04:26 PM »

Making a Zelda Game:
Code:
case RoomObjectType.Pot:
    break;
Logged

teomat
Guest
« Reply #83 on: June 15, 2011, 12:28:27 AM »

Making a Zelda Game:
Code:
case RoomObjectType.Pot:
    break;


ahahaha, that made me lol too
Logged
Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« Reply #84 on: June 15, 2011, 12:44:43 PM »

Can I still post here if I was crying while I was laughing?
Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
shadowdim
Level 1
*



View Profile
« Reply #85 on: July 02, 2011, 03:22:31 PM »

Debugging my AS3:

Code:
trace("on");

So, yeah, mostly a Fate/Stay Night joke. Hope someone will get it.
Logged
_Tommo_
Level 8
***


frn frn frn


View Profile WWW
« Reply #86 on: July 08, 2011, 09:07:52 AM »

Code:
queueSemaphore.wait();

//awoken to be killed (oh the irony)
if( !running )
break;

I lolled SO hard   Big Laff
Logged

iPhoenix
Level 0
*


View Profile
« Reply #87 on: July 10, 2011, 06:16:54 AM »

Code:
//getScore (score, time, deaths)
var s, t, d;
s = argument0
t = argument1
d = argument2;
return s / (t * d)
I could've worked with the arguments only, but I guess I want my code to be tidied up.
When I saw what I did, I went all FML.
Logged
geomaster
Level 0
*


View Profile
« Reply #88 on: August 02, 2011, 10:34:56 AM »

This is one of my all-time favorites:
Code:
namespace /* You just lost the */ Game
And I needed a moment to see what I did here:
Code:
assert(Column<3 && Row<3);
Then I added a comment saying 'columns and rows need love too!' Smiley
Logged
Evan Balster
Level 10
*****


I live in this head.


View Profile WWW
« Reply #89 on: August 25, 2011, 06:19:24 PM »

Dear lord.  D:

I think the reason I've never written anything blockified that hard is that I keep my lines under 80 characters at all times, and it starts to be a pain writing lines that short.
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>
st33d
Guest
« Reply #90 on: August 26, 2011, 01:20:25 AM »

Code:
override public function main():void {
super.main();
if(killState == 0){
if(state == IDLE){
if(getPlayerTarget()){
state = OPEN;
count = OPEN_DELAY;
}
} else if(state == OPEN){
if(count) count--;
else {
// DIIIIIIIIIIIIIVVVVEEEE!
state = DIVE;
collider.state = Collider.FALL;
}
} else if(state == DIVE){
playerTarget = getPlayerTarget();
if(playerTarget){
if(playerTarget.collider.x > collider.x + collider.width){
collider.vx += speed;
} else if(playerTarget.collider.x + playerTarget.collider.width < collider.x){
collider.vx -= speed;
}
}
if(collider.pressure & DOWN){
state = RETURN;
collider.state = Collider.HOVER;
}
} else if(state == RETURN){
collider.vy -= speed;
if(collider.pressure & UP){
if(getPlayerTarget()){
// SECOND WAVE, DIIIIIIIIIIIIVVVEEEE!
state = DIVE;
collider.state = Collider.FALL;
} else {
state = CLOSE;
count = OPEN_DELAY;
}
}
} else if(state == CLOSE){
if(count) count--;
else {
state = IDLE;
}
}
}
}
Logged
Trevor Dunbar
Level 10
*****


Working on unannouned fighting game.


View Profile
« Reply #91 on: August 26, 2011, 03:08:08 AM »

Code:
int elligence


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

Quote
It is not known precisely how the exact value for the magic number was determined.

It was created with black programming magic.
« Last Edit: August 26, 2011, 03:29:36 AM by Trevor Dunbar » Logged

Toucantastic.
TaintedFork
Level 0
***



View Profile WWW
« Reply #92 on: August 26, 2011, 08:34:53 PM »

This isn't game programming related, but it is programming.

The other day I was writing a Mac app in Objective-C. I subclassed NSWindow to make my own window. This happened:

Code:
[self center];

My window is self-centered. Big Laff Hand Thumbs Up Right
Logged
trq
Level 0
***



View Profile WWW
« Reply #93 on: August 27, 2011, 01:48:10 AM »



This is why I hate ECMA-like languages
Logged
geomaster
Level 0
*


View Profile
« Reply #94 on: August 27, 2011, 12:49:38 PM »



This is why I hate ECMA-like languages
I don't think you can say C++ is ECMA-like. And using another language here makes no difference. Just sayin'
Logged
MadSage
Level 0
**


View Profile
« Reply #95 on: August 27, 2011, 12:58:15 PM »

I would cry (not laugh) if I came across nesting like that Shocked  It reminds of the awful renderer someone wrote at the first studio I worked at.  I so badly wanted to refactor it.
Logged

Mikademus
Level 10
*****


The Magical Owl


View Profile
« Reply #96 on: August 27, 2011, 03:22:27 PM »

I would cry (not laugh) if I came across nesting like that Shocked  It reminds of the awful renderer someone wrote at the first studio I worked at.  I so badly wanted to refactor it.

Perhaps it was a very, very sad, or possibly deranged, laugh? But yeah, that is not funny code, it is simply bad. Not so bad it is funny, but so bad it is awful Sad
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
Ashkin
Guest
« Reply #97 on: August 27, 2011, 04:22:17 PM »

Code:
//I ain't saying she's a
public class GoldDigger extends Digger
I
am
HORRIBLE
Logged
Evan Balster
Level 10
*****


I live in this head.


View Profile WWW
« Reply #98 on: August 28, 2011, 12:00:25 PM »

bool _ = true;
for ( ;_; )
{
  //Infinite loop is sad
}
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>
hopwep
Level 0
**


View Profile
« Reply #99 on: August 31, 2011, 01:26:46 AM »

Thtats a ruby code that totally sucks. It was one of the first things i writed, i think. It was a system so i created the extra actor atributes using methods and cases. At the first i writed that in a class called 'Other' that functions like C libraries, lol, XD.

Code:
  
  #--------------------------------------------------------------------------
  # * Calculate actor crit rate
  #--------------------------------------------------------------------------
  def crit_rate
    #Declaraciones
    crit = super()
    acrit = []
    ccrit = []
    # These two are totally useles, arrays whose i had to changue
#the name each time for each atribute and then why not use the switch here?
    #Por personaje
    puts acrit[1] = 7
    # That also sucked. puts!, wtf, i dont remmebr but it dont need it in ruby.
 #It also that method make that you have to set a value for each character or it will explode.
    crit += acrit[id]
   
    #Por clase
    puts ccrit[1] = 7
    crit += ccrit[class_id]
    # Same here

    #Por equipacion
      case weapon_id
       when 1 ; crit += 5
       when 2 ; crit += 6

       end
    #Otros elementos
   
    #Luck
    crit += @suerte/2
   
    return crit
 
  end

Im actually improving a little game i started in pygame a year later(now are two years or more). It was all the code and classes in a only unique file with 2000 lines. It totally sucked and the OO used was totally laughlable...

This is my rewrite of the first thing:

Code:
  
  #--------------------------------------------------------------------------
  # * Calculate actor crit rate
  #--------------------------------------------------------------------------
  def crit_rate
    #Declaraciones
    v = super()

    #By actor
      case @actor_id
       when 1 ; v += 11

      end

    #Por equipacion
      case @weapon_id
       when 1 ; v += 5
       when 2 ; v += 6

      end

    return v
 
  end

Also luck is implemented now in the basic formula, a lot better.
« Last Edit: August 31, 2011, 01:37:58 AM by hopwep » Logged
Pages: 1 ... 3 4 [5] 6 7 ... 27
Print
Jump to:  

Theme orange-lt created by panic