TGC Codebase Backup



Random Football by soapyfish

9th Jun 2005 18:44
Summary

Really, really, really use of the rnd command to determine the outcome of something.



Description

I wanted to get into the habit of helping people more and decided whenever I post a code snippet to help someone I'll also post it here. It may be really, really, really simple but hopefully someone will find a use for it. :o)



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    `tell computer to randomize the seed value
randomize timer()

DO
   `tell the computer to pick a random number upto a maximum of 2
   `and make that number the "score" variable
   score=rnd(2)
   `tell the computer that if the score variable=1, print MISS on screen
   if score=1 then text 100,100,"MISS"
    `tell the computer that if the score variable=2, print SCORE on screen
   if score=2 then text 100,100,"SCORE"
   `wait for 100
   wait 100
   `clear screen
   cls
LOOP