home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / rpos2101.zip / GUESS.P < prev    next >
Text File  |  1998-06-05  |  1KB  |  51 lines

  1. R: guess.p - A simple number guessing game
  2.  : Written by Rob Linwood (auntfloyd@biosys.net)
  3.  
  4. *start
  5.  
  6. T: I will think of a random number between 1 and 100. Can you guess it?
  7.  :
  8.  
  9. R: Get a random number between 1 and 100 and put it in #rand
  10. G: #rand 1 100
  11.  
  12. R: Initialize the #tries variable, whcih holds the number of tries
  13. C: #tries = 0
  14.  
  15. *guess
  16.  
  17. R: Get the player's guess
  18. T: Guess!
  19. A: #guess
  20.  
  21. R: Increase the number of tries
  22. C: #tries = #tries + 1
  23.  
  24. R: Jump to the proper place based on whether the player guessed the number,
  25.  : guessed too high, or guessed too low
  26. J(#guess = #rand): win
  27. J(#guess > #rand): toobig
  28. J(#guess < #rand): toosmall
  29.  
  30. *toobig
  31. T: Too big!
  32.  :
  33. J: guess
  34.  
  35. *toosmall
  36. T: Too small!
  37.  :
  38. J: guess
  39.  
  40. *win
  41. T(#tries > 1): Congratulations!  You guessed it in #tries guesses!
  42. T(#tries = 1): Congratulations!  You guessed it in 1 guesse!  Lucky!
  43. T: Play again? (Y/N)
  44. A:
  45. M: y yes yep sure
  46. R: If any of the above match, (ie #matched = 1), jump to start
  47. JY: start
  48. E:
  49.  
  50.  
  51.