| |
|
|
p.specht
|
Window Title "DAS SPIEL NIMM"
' (CL) CopyLeft 2014-09 by P. woodpecker, Wien. No however geartete Gewähr!
' there's for player, the begins a strategy, with the it not lose can.
' To Beginn takes the later Gewinner one match. then depends it itself to seinem
' opponent or. attempts always a Viererzahl To achieve. because if it the opponent in the letzteb
' train as selection 4 Hölzchen präsentiert, can ER the latest Hölchen take and win so.
Windowstyle 24:Randomize : font 2 : declare b&,m&,h&,x&,y&,s$ : h&=9+rnd(21)
Start:
b&=0:m&=0:CLS
Print "\n The Zufallsgenerator places in this round ";h&;" Hölzchen from."
show h&
Print "\n who should begin {1=Spieler, 0=Computer}?: ";:Input b&
print " --------------------------------------------------------"
Loop:
If b&=0 : cls:print "\n The computer is dran."
else : print "\n player is dran. "
endif
inc m& : print "\n ";int(m&/2);". train: yet lying ";h&;" Hölzchen on the table.\n"
show h&
if b&=0
' profit-train: possible on a Viererzahl bring
x&=h& mod 4:case x&=0:x&=1'bad luck for Compi: 0 is not!
print " computer takes ";x&;" Hölzchen lane. ":h&=h&-x&
else :again:
print " Wieviele Hölzchen would tappt im dunkeln take away {1,2 or 3}?: ";:input y&
case (y&<1) or (y&>3):goto "nochmal"
print "\n player has ";y&;" Hölzchen removed.":h&=h&-y&
endif
b&=hardship(b&)
print "\n After the ";m&;". train lying now ";h&;" Hölzchen on the table.\n"
show h&
waitinput 2000
if h&<=0 :print "\n *********************************"
if b&=0:print " * player win! Congratulations! *"
else :print " * computer has won. *"
endif :print " *********************************"
print "\n another game {1=Ja}?: ";:input s$:case s$="1":goto "Start"
print "\n see again!":waitinput 6000:end
else
print " --------------------------------------------------------"
waitinput 1000:goto "Loop"
endif
END
proc show :parameters h&
usepen 1,1,rgb(255,255,255):usebrush 1,rgb(255,255,255)
rectangle 0,13/20*height(%hwnd) - width(%hwnd),height(%hwnd)
whileloop h&
usepen 0,7,rgb(200,200,100)
line &Loop*width(%hwnd)/30,(14*height(%hwnd)/20) - &Loop*width(%hwnd)/30, 19/20*height(%hwnd)
usepen 0,14,rgb(230,70,0)
line &Loop*width(%hwnd)/30,(14*height(%hwnd)/20) - &Loop*width(%hwnd)/30, 14/20*height(%hwnd)
endwhile
endproc
|
|
|
| XProfan 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 05/15/21 ▲ |
|
|
|