that's okay... with an attitude like that you weren't made out for a programming job anyway.Originally Posted by ckeener
With coding, as with everything in life, you need to modularize. not only your code, but your algorithm... in more simplistic terms, break it down. look at what you need to do before you try to do it:
- Pick a random number (spin the wheel)
- move that random amount of times
- depending on where you end up, do something
now you break it up even further, for example, let's take that last bullet:
- if you land on an empty space, do nothing
- if you end up on a ladder, go to to the space it points to
- if you end up on a chute, go to the space it points to.
now we turn those steps into pseudocode :
- if the space contains zero (0), go nowhere
- if the space contains a negative number, acknowledge that it's a chute (print something to the screen), and go backwards that amount of spaces, wrapping to the next line if necessary
- if the space contains a positive number, acknowledge that it's a ladder (print something to the screen), and go forwards that amount of spaces, wrapping to the next line if necessary