Nim game: Difference between revisions

Content added Content deleted
Line 1,136: Line 1,136:
<syntaxhighlight lang="basic">title "NIM"
<syntaxhighlight lang="basic">title "NIM"


let h = 12
let h = int: (rnd) * 12 + 12


label loop
label loop
Line 1,149: Line 1,149:
endif
endif


let h = h - t
if t <= 3 and t >= 1 then


if h = 0 then
let h = h - t


if h = 0 then
alert "Congratulations. You got the last token."
end


alert "Congratulations. You got the last token."
endif
end


endif
let t = 4 - t


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


let h = h - t
if h = 0 then


alert "I got the last token. I win. Better luck next time."
if h = 0 then
end


endif
alert "I got the last token. I win. Better luck next time."
end


endif
endif