home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 2
/
BUGCD1997_01.iso
/
utils
/
winbatch
/
stones.wb_
< prev
next >
Wrap
Text File
|
1994-08-19
|
3KB
|
106 lines
;Stones game
; RemainingStones is the number of remaining stones. (15 thru 35)
; MaxTakePerTurn is the most you can take away at one time (3 thru 6)
CR=StrCat(Num2Char(13),Num2Char(10))
a1="In this game, the players, you and the~"
a2="computer, start with a common pile of~"
a3="many stones, usually between 15 and 35.~~"
a4="While alternating turns, you take away~"
a5="one or more stones from the pile.~"
a6="You may not take more than some agreed~"
a7="upon number of stones, usually between~"
a8="three and six.~~"
a9="Whoever is forced to take the last~"
a10="stone loses.~~"
a11="You get to go first."
directions=strcat(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
TextSelect("HOW 2 PLAY STONES",directions,"~")
drop(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,directions)
:playitagainsam
MyBoxText="Starrrrting up Stones"
RemainingStones=Random(21)
;Normalize RemainingStones to be between 15 and 35
RemainingStones = RemainingStones + 15
MaxTakePerTurn=Random(3)
;Normalize MaxTakePerTurn to be between 3 and 6
MaxTakePerTurn = MaxTakePerTurn + 3
TheMagicNumber = MaxTakePerTurn + 1
BoxOpen("Stones Stones Stones",MyBoxText)
PlayWaveform("TaDa.wav",1)
WinPlace(800,800,1000,1000,"Stones Stones Stones")
Delay(1)
WinPlace(500,500,900,900,"Stones Stones Stones")
Delay(1)
WinPlace(300,300,800,800,"Stones Stones Stones")
Delay(1)
WinPlace(100,100,800,700,"Stones Stones Stones")
MyBoxText=strcat(MyBoxText,cr,"Starting with %RemainingStones% Stones.")
BoxText(MyBoxText)
:next
PlayerTakes=AskLine("STONES","%RemainingStones% Stones left. Take 1 to %MaxTakePerTurn% stones","")
if PlayerTakes<1 then goto cheat
if PlayerTakes>MaxTakePerTurn then goto cheat
goto gotok
:cheat
Message("GRAVEL","You cheat! You may only take 1 to %MaxTakePerTurn% stones.")
goto next
:gotok
MyBoxText=strcat(MyBoxText,cr,"Human takes %PlayerTakes% stones")
BoxText(MyBoxText)
if PlayerTakes>=RemainingStones then goto youlose
RemainingStones = RemainingStones - PlayerTakes
if RemainingStones==1 then goto complose
MyMove =RemainingStones - 1
MyMove = MyMove mod TheMagicNumber
if MyMove == 0 then MyMove = Int(max(1,Random(MaxTakePerTurn)))
StonesLeft =RemainingStones - MyMove
MyBoxText=strcat(MyBoxText,cr,"Hmm %RemainingStones% stones left. I take %MyMove% stones, leaving %StonesLeft%.")
BoxText(MyBoxText)
RemainingStones = StonesLeft
if RemainingStones==1 then goto youlose
goto next
:youlose
MyBoxText=strcat(MyBoxText,cr,"Human stuck with final stone.")
BoxText(MyBoxText)
Message("ROCKS","Nyah Nyah Nyah. You Lose.")
goto bye
:complose
MyBoxText=strcat(MyBoxText,cr,"Hmmm I lost. Human must be running program on defective CPU.")
Message("PEBBLES","What!!!???!! I lost???%cr%CPU must be defective.%cr%Please replace.")
BoxText(MyBoxText)
:bye
Response=AskYesNo("BOULDERS","Would you like to play again?")
if Response == @TRUE then goto playitagainsam
ErrorMode(@off)
BoxShut()
return
:cancel
Display(1,"Cancelled","User cancelled Stones")
return