   just a rant
  i just wrote some code in a very short time for my tetris clone, which works fine.  5 minutes later I look at the code again, it doesnt make sence, i try to make sence out of it and change a few things, making it into a big mess.... aaargggIm just amazed how some times you got the mojo and things flow, then the next day a tree will have more smarts then me.go oilers go   
  Lack of comments in the code maybe?   ;  Ah, screw the trees.  Those stuck up bastards always think they're so clever.  But I have the chainsaw!   ;  This would be a good opportunity to review your comments, naming conventions etc. A good way to do things is to write your pseudo code as comments first, then start filling in code between comments. Not only did you write the basic algorithm down (so you don't forget what you're trying to do) but the comments serve to explain the code. I'm sure when you solve the problem again you'll understand how the previous algorithm worked, and might even be able to write it more efficiently this time. Don't worry about it too much, this sort of thing happens to everyone.   ;  Read the book Code Complete. Its a little heafty, but worth your time. You can find it here on GameDev if you flex your searching muscles. It goes over many good techniques for making your code work. Just a couple points:-Name variables/classes/functions descriptively-Use functions and classes, not just one big file-Use comments and psuedo code-Be consistent-Use indentsOkay, thats some stuff to think about.   