I was looking over the program listing for Lemonade Stand, and the following line has me confused:
2230 IF RND ( - 1) < .5 THEN 2233
It seems to me that RND ( - 1 ) will always return 2.99196472E-08, and therefore it can never be < .5. Or am I not understanding how the RND command works?
Michael
Michael,
It seems to be the correct beheviour. According to The AppleSoft II Basic Programming Reference Manual, it is stated on page 102 :
It almost seems like someone was thinking in assembly while writing in BASIC. Forcing a 'conditional' jump to occur all the time during that statement's execution.
Then again it might just be a bug in the original programming, possibly intended to be RND(1)
Have you tried replacing the RND(-1) with RND(1) and evaluating the game-play? Who knows, maybe after all these years we'll see the secret cow-level with that change!
Cheers,
Craig
Thanks for the replies. I haven't tried changing it yet, but I probably will test it out. I'll prolly trace the program flow on paper first because I doubt I'd notice the difference. I'm actually playing around with porting it for the C64 (the official Commodore version was pretty un-fun.) So far it works and graphics are similar but no music yet! It's a lot of fun and you can learn new ways of approaching problems from cross-platform conversion.
Michael