Originally Posted by
Matticus
CommonTater makes a great point.
I'd like to add ... Untangling code in the text editor can be difficult, at times - sometimes leading to the habit of just moving things around until it works.
Have you sat down with a pen and paper during the construction of this code? This is what personally helps me the most with solving difficult problems. Go through your code and write down variable values, working out the results by hand. Do not glaze over any commands - meticulously take each statement into account. Don't be afraid to draw crude diagrams to help illustrate/visualize what is going on. More often than not, while a bit tedious, this will result in clearly highlighting any problem behavior.
EDIT: Deadline pressure will do nothing to help you. It's important - but putting it out of your mind is probably the only way you're going to be able to pull through so quickly.