RosettaCodeData/Task/Nim-game/XBasic/nim-game.basic

25 lines
567 B
Text
Raw Permalink Normal View History

2026-04-30 12:34:36 -04:00
PROGRAM "nim-game"
VERSION "0.0000"
2024-07-13 15:19:22 -07:00
DECLARE FUNCTION Entry ()
FUNCTION Entry ()
monton = 12
DO WHILE monton > 0
PRINT "There are "; monton; " tokens remaining. How many would you like to take? ";
llevar = UBYTE(INLINE$(""))
DO WHILE (llevar <= 0) OR (llevar > 3)
2026-04-30 12:34:36 -04:00
llevar = UBYTE(INLINE$("You must take 1, 2, or 3 tokens. How many would you like to take"))
2024-07-13 15:19:22 -07:00
LOOP
2026-04-30 12:34:36 -04:00
PRINT "On my turn I will take"; 4 - llevar; " token(s)."
2024-07-13 15:19:22 -07:00
monton = monton - 4
LOOP
PRINT "\nI got the last token. I win! Better luck next time."
END FUNCTION
END PROGRAM