View Single Post
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 04-23-2010, 12:27 PM

Quote:
Originally Posted by Dameria View Post
Variables are one of the most important parts of good programming though, and the Alice community should start using them more often if we want to start making more realistic games.
He's right. We have to be open to new ideas in order to learn to become truly good programmers.

For example: when I was in advanced programming, we had to make this keno game program as one of our assignments. As some of you may know, keno involves lots of squares with numbers which the user has to click to choose what numbers he thinks will be randomly generated by the computer. Every single one of my classmates instantly got to work making massive nested if/else if statements to set up hotspots for the squares, but I couldn't help but think there was an easier way, so I sat and thought about it while they worked. When they were about 1/4 of the way done, I discovered a formula that would easily calculate coordinates for equal sized and spaced squares on a 800x600 pixel frame (and save about 500 lines of code), and with that formula I was able to finish before they did and get extra credit for thinking outside the box.

Moral of the story: just because you know it already doesn't make it the best thing to do.


(')>
   
Reply With Quote