Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2]
  Print  
  Share the worst code you have ever seen...  (Read 4969 times)
0 Members and 1 Guest are viewing this topic.
Offline Breakfast

JGO Strike Force
***

Posts: 784
Medals: 1


for great justice!


« Reply #30 on: 2004-12-15 15:27:26 »

From a very early web application I wrote (that is funnily enough still working fine. It's not terrible code in itself, unlike the lines of string1+=string2, but the variable naming is a little unorthodox:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
public static int[][] swapTheSwippa(int[][] swippaswappa, int stop)
      {

      int start = getfromhere(swippaswappa);
      int[][] swuppaswuppa = new int[swippaswappa.length][4];
      if (start!=stop)
            {      
            for(int i=0; i<start; i++)            
                  swuppaswuppa[i] = swippaswappa[i];
            swuppaswuppa[start]=swippaswappa[stop];      
            for(int i=(start+1); i<=stop; i++)      
                  swuppaswuppa[i]=swippaswappa[i-1];      
            for(int i=stop+1;i<swippaswappa.length;i++)
                  swuppaswuppa[i]=swippaswappa[i];
            }
      else swuppaswuppa=swippaswappa;
           
      swuppaswuppa[start][3]=1;
      return swuppaswuppa;
      }
Offline Grazer

Jr. Member
**

Posts: 64


My other avatar is much more flattering.


« Reply #31 on: 2004-12-15 15:35:30 »

Quote
1  
2  
3  
4  
5  
Vector v = new Vector();
if(v != null)
{
.....
}


This may have come from an expert C++ programmer, where strange things happen when there's no memory, rather than just seeing an exception fly by.

Current Project: Easy Decal
Other Stuff: grlea online
Offline Raghar

Sr. Member
**

Posts: 331


Ue ni taete 'ru hitomi ni kono mi wa dou utsuru


« Reply #32 on: 2004-12-15 15:48:17 »

You never know how "new" was overloaded.

re  crystalsquid
Pairing? Ignoring lastest version of CPU? Oh dear, just again that ugly microoptimalizations for old CPU. It was a reason why Intel didn't improved it fast enough.
Games published by our own members! Go get 'em!
Offline oNyx

JGO Kernel
*****

Posts: 2943
Medals: 5


pixels! :x


« Reply #33 on: 2004-12-15 19:33:22 »

1  
2  
3  
4  
5  
6  
7  
8  
if(!(user.equals(""))&&!(user.equals(" "))&&!(user.equals("  ")) 
&&!(user.equals("   "))&&!(user.equals("    "))
&&!(user.equals("     "))&&!(user.equals("      "))
&&!(user.equals("       "))&&!(user.equals("        "))
&&!(user.equals("         "))&&!(user.equals("            "))
&&!(user.length()>=10)&&!(user.equals("Bitte Namen eingeben"))){
      [...]
      }


What? Trim you say? Smiley

Stacktraces? We need no stinking stacktraces!
1  
catch (Exception e) { output.setText("ERROR"); }


(output is a JTextArea)

Ah well, he's still a newbe and promised to not do anything like that ever again Grin

弾幕 ☆ @mahonnaiseblog
Offline cfmdobbie

JGO Wizard
****

Posts: 1257


Who, me?


« Reply #34 on: 2004-12-16 02:58:26 »

For quite some time we've been seeing entries in a history log that just say "message".  I found the cause today, after uncovering code similar to the following:

1  
2  
3  
4  
5  
public void method(String message) {
  [...]
  statement.setString("message");
  [...]
}


Hmm...

Hellomynameis Charlie Dobbie.
Offline MickeyB

JGO Ninja
***

Posts: 547


my game will work, my game will work!


« Reply #35 on: 2004-12-16 06:45:10 »

Nope, wont do it.  Refuse to do it...will not post all of my code here!! Wink

My code for work isnt too bad..my game code is spaghetti.
What do you expect though, I studied Cellular Biology and Chemistry in college (university for those of you 'cross the pond).  LOL

MickeyB

Current Project: http://www22.brinkster.com/mbowles/
Offline crystalsquid

Full Member
**

Posts: 214


... Boing ...


« Reply #36 on: 2004-12-16 10:04:47 »

Quote
re  crystalsquid
Pairing? Ignoring lastest version of CPU? Oh dear, just again that ugly microoptimalizations for old CPU. It was a reason why Intel didn't improved it fast enough.

I like assembler & optimising at this level  Wink

If you know what you're doing you can usually double the speed of any decently large function (such as vector transform & perspectivise, software renderers etc.)

The insights from learning how to optimise can help you write C/Java code that runs at least 10% faster just by knowing a few tricks and how code is really translated - and once it becomes second nature then it doesn't cost any more development time - and done properly it rarely produces code that would appear in this thread Smiley

One clipping routine I came across had the comments:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
// its just a clip to the left...

// And then a clip to the ri-i-i-ight...

// You put the verts on your knees...

// And pull the bounds in ti-i-i-ight

// Do the nested thrusts...

// It'll drive you insa-a-a-ne

// Lets do the clipping again!

It's not big, & its not clever Smiley
Pages: 1 [2]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.256 seconds with 20 queries.