wow...
Today was a rip-off day and a day full of wasted time...
I thought that I woke up at 8 o'clock and decided to doze off for another 5 minutes then...BANG!!! I wake up and it's 10:30!!!
No one's at home, except for my little brother, who's playing some RPG game, and me, being extremely stupid, decided to help him beat the game...
I ate breakfast at 11 and went to play piano for a full hour before lunch came at 12! I rode my bike (yes, in the cold and snow!) to the recreational centre for rec swimming (like Monday), only today, there was only lane swimming for old people! So, I went back home and at 3 o'clock, I had accomplished nothing!
Anyways, at 5 o'clock, I went back to the computer and spent only half and hour polishing my snake game by eliminating two excess and useless loops which made the program more confusing and inserting helpful comments all over the code. I cut out approximately 100 lines of code, just by eliminating useless loops. Previously, without those loops, my game would explode so I kept the loops at where they were, but then I made 6 Prototypes (yes, I wasn't crazy and there was a reason for six of them...) and finally solved the problem of eliminating the 2 loops without encountering problems...
I also took out 4 boolean variables (directionUp, directionDown, directionLeft, directionRight) which controlled the direction of the snake and replaced them with a single string variable (direction). With direction, I was able to use case instead of lots of ifs and elsifs because you couldn't use cases for chars (KEY_UP_ARROW) and long if ladders were the only solution.
Currently in my Snake Game directory, I have only 2 Prototypes; one which does not draw tails and is only 269 lines long (the Prototype in which I edited today...) and the other which does draw tails (which is 120 lines longer). The Prototype that draws tails does not function properly yet, so tomorrow, I'll work on that...
No comments:
Post a Comment