home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windoware
/
WINDOWARE_1_6.iso
/
winutil
/
winbatch
/
stones.wbt
< prev
next >
Wrap
Text File
|
1991-01-03
|
2KB
|
66 lines
;Stones game
; s is the number of remaining stones. (15 thru 35)
; t is the most you can take away at one time (3 thru 6)
CR=strcat(num2char(13),num2char(10))
textbox("HOW 2 PLAY STONES","stones.wtx")
if WinExist("Clipboard") then WinZoom("Clipboard")
if !WinExist("Clipboard") then runzoom("clipbrd.exe","")
:playitagainsam
s=random(21)
;normalize s to be between 15 and 35
s = s + 15
t=random(3)
;normalize t to be between 3 and 6
t = t + 3
v = t + 1
clipput("STONES%CR%")
clipappend("Starting with %s% Stones.%CR%")
:next
a=askline("STONES","%s% Stones left. Take 1 to %t% stones","")
if a<1 then goto cheat
if a>t then goto cheat
goto gotok
:cheat
Message("STONES","You cheat! You may only take 1 to %t% stones.")
goto next
:gotok
clipappend("Human takes %a% stones%CR%")
if a>=s then goto youlose
s = s - a
if s==1 then goto complose
y =s - 1
y = y mod v
if y == 0 then y = 1
l =s -y
clipappend("Hmm %s% stones left. I take %y% stones, leaving %l%.%CR%")
s = s - y
if s==1 then goto youlose
goto next
:youlose
Clipappend("Human stuck with final stone.%CR%")
Message("STONES","Nyah Nyah Nyah. You Lose.")
goto bye
:complose
Clipappend("Hmmm I lost. Human must be running program on defective CPU.%CR%")
Message("STONES","Hmmm. I lost. CPU must be damaged. Please replace.")
:bye
a=askyesno("STONES","Would you like to play again?")
if a == @TRUE then goto playitagainsam
errormode(@off)
if WinExist("Clipboard") then WinClose("Clipboard")
exit