Nim game: Difference between revisions
→{{header|Common Lisp}}
Basicgames (talk | contribs) |
|||
Line 1,132:
Computer wins!
</pre>
=={{header|Craft Basic}}==
<syntaxhighlight lang="Craft Basic">title "NIM"
let h = 12
label loop
print "There are ", h ," tokens remaining."
input "How many would you like to take? ", t
if t > 3 or t < 1 then
print "You must take between 1 to 3 tokens."
endif
let h = h - t
if h = 0 then
alert "Congratulations. You got the last token."
end
endif
let t = 4 - t
print "I will take ", t ," tokens."
let h = h - t
if h = 0 then
alert "I got the last token. I win. Better luck next time."
end
endif
goto loop
</syntaxhighlight>
=={{header|Crystal}}==
|