Jump to content

Nim game: Difference between revisions

m
Line 1,166:
=={{header|Craft Basic}}==
<syntaxhighlight lang="basic">title "NIM"
 
bgcolor 0,180,0
cls
wait
 
let h = 12
 
label loop
do
 
print "There are ", h ," tokens remaining."
Line 1,180 ⟶ 1,184:
endif
 
if th <= 3 and- t >=< 10 then
 
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}}==
305

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.