Nim game: Difference between revisions

Content added Content deleted
(Added Z80 Assembly version)
Line 744: Line 744:


==={{header|Craft Basic}}===
==={{header|Craft Basic}}===
<syntaxhighlight lang="basic">title "NIM"
<syntaxhighlight lang="basic">let h = 12

bgcolor 0,180,0
cls
wait

let h = 12


label loop
label loop


print "There are ", h ," tokens remaining."
alert "There are ", h ," tokens remaining."
input "How many would you like to take? ", t
input "How many would you like to take? ", t


if t > 3 or t < 1 then
if t > 3 or t < 1 then


print "You must take between 1 to 3 tokens."
alert "You must take between 1 to 3 tokens."


endif
endif
Line 765: Line 759:
if h - t < 0 then
if h - t < 0 then


print "You cannot take that many. There's only ", h ," left."
alert "You cannot take that many. There's only ", h ," left."


endif
endif
Line 794: Line 788:
endif
endif


print "I will take ", t ," tokens."
alert "I will take ", t ," tokens."
let h = h - t
let h = h - t