home *** CD-ROM | disk | FTP | other *** search
/ PC World 1999 February / PCWorld_1999-02_cd.bin / software / Zkuste / WinBat98 / STONES.WB_ < prev    next >
Text File  |  1994-08-19  |  3KB  |  106 lines

  1.  
  2. ;Stones game
  3.  
  4. ; RemainingStones is the number of remaining stones. (15 thru 35)
  5. ; MaxTakePerTurn is the most you can take away at one time  (3 thru 6)
  6.  
  7. CR=StrCat(Num2Char(13),Num2Char(10))
  8. a1="In this game, the players, you and the~"
  9. a2="computer, start with a common pile of~"
  10. a3="many stones, usually between 15 and 35.~~"
  11.  
  12. a4="While alternating turns, you take away~"
  13. a5="one or more stones from the pile.~"
  14. a6="You may not take more than some agreed~"
  15. a7="upon number of stones, usually between~"
  16. a8="three and six.~~"
  17.  
  18. a9="Whoever is forced to take the last~"
  19. a10="stone loses.~~"
  20.  
  21. a11="You get to go first."
  22.  
  23. directions=strcat(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
  24.  
  25. TextSelect("HOW 2 PLAY STONES",directions,"~")
  26. drop(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,directions)
  27.  
  28.  
  29.  
  30.  
  31. :playitagainsam
  32. MyBoxText="Starrrrting up Stones"
  33. RemainingStones=Random(21)
  34. ;Normalize RemainingStones to be between 15 and 35
  35. RemainingStones = RemainingStones + 15
  36.  
  37. MaxTakePerTurn=Random(3)
  38. ;Normalize MaxTakePerTurn to be between 3 and 6
  39. MaxTakePerTurn = MaxTakePerTurn + 3
  40. TheMagicNumber = MaxTakePerTurn + 1
  41.  
  42. BoxOpen("Stones Stones Stones",MyBoxText)
  43. PlayWaveform("TaDa.wav",1)
  44. WinPlace(800,800,1000,1000,"Stones Stones Stones")
  45. Delay(1)
  46. WinPlace(500,500,900,900,"Stones Stones Stones")
  47. Delay(1)
  48. WinPlace(300,300,800,800,"Stones Stones Stones")
  49. Delay(1)
  50. WinPlace(100,100,800,700,"Stones Stones Stones")
  51.  
  52. MyBoxText=strcat(MyBoxText,cr,"Starting with %RemainingStones% Stones.")
  53. BoxText(MyBoxText)
  54.  
  55. :next
  56.  PlayerTakes=AskLine("STONES","%RemainingStones% Stones left. Take 1 to %MaxTakePerTurn% stones","")
  57.  
  58. if PlayerTakes<1 then goto cheat
  59. if PlayerTakes>MaxTakePerTurn then goto cheat
  60. goto gotok
  61.  
  62. :cheat
  63. Message("GRAVEL","You cheat!  You may only take 1 to %MaxTakePerTurn% stones.")
  64. goto next
  65.  
  66. :gotok
  67. MyBoxText=strcat(MyBoxText,cr,"Human takes %PlayerTakes% stones")
  68. BoxText(MyBoxText)
  69. if PlayerTakes>=RemainingStones then goto youlose
  70.  
  71. RemainingStones = RemainingStones - PlayerTakes
  72. if RemainingStones==1 then goto complose
  73.  
  74. MyMove =RemainingStones - 1
  75. MyMove = MyMove mod TheMagicNumber
  76. if MyMove == 0 then MyMove = Int(max(1,Random(MaxTakePerTurn)))
  77. StonesLeft =RemainingStones - MyMove
  78. MyBoxText=strcat(MyBoxText,cr,"Hmm %RemainingStones% stones left. I take %MyMove% stones, leaving %StonesLeft%.")
  79. BoxText(MyBoxText)
  80. RemainingStones = StonesLeft
  81. if RemainingStones==1 then goto youlose
  82. goto next
  83.  
  84. :youlose
  85. MyBoxText=strcat(MyBoxText,cr,"Human stuck with final stone.")
  86. BoxText(MyBoxText)
  87. Message("ROCKS","Nyah Nyah Nyah.  You Lose.")
  88. goto bye
  89.  
  90. :complose
  91. MyBoxText=strcat(MyBoxText,cr,"Hmmm I lost.  Human must be running program on defective CPU.")
  92. Message("PEBBLES","What!!!???!!  I lost???%cr%CPU must be defective.%cr%Please replace.")
  93. BoxText(MyBoxText)
  94. :bye
  95. Response=AskYesNo("BOULDERS","Would you like to play again?")
  96. if Response == @TRUE then goto playitagainsam
  97. ErrorMode(@off)
  98. BoxShut()
  99. return
  100.  
  101. :cancel
  102. Display(1,"Cancelled","User cancelled Stones")
  103. return
  104.  
  105.  
  106.