Nim game: Difference between revisions
m
→{{header|Craft Basic}}
m (→{{header|Red}}) |
Basicgames (talk | contribs) |
||
Line 1,166:
=={{header|Craft Basic}}==
<syntaxhighlight lang="basic">title "NIM"
bgcolor 0,180,0
cls
wait
let h = 12
label loop
print "There are ", h ," tokens remaining."
Line 1,180 ⟶ 1,184:
endif
if
print "You cannot take that many. There's only ", h ," left."
endif
if t <= 3 and t >= 1 and h - t >= 0 then
let h = h - t
Line 1,192 ⟶ 1,202:
let t = 4 - t
if h >= 15 then
let t = 3
endif
if h <= 3 then
let t = h
endif
print "I will take ", t ," tokens."
let h = h - t
Line 1,204 ⟶ 1,227:
endif
goto loop</syntaxhighlight>
=={{header|Crystal}}==
|