Data update
This commit is contained in:
parent
52a6ef48dd
commit
157b70a810
604 changed files with 14253 additions and 2100 deletions
30
Task/Nim-game/FutureBasic/nim-game.basic
Normal file
30
Task/Nim-game/FutureBasic/nim-game.basic
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
void local fn NimGame
|
||||
window 1, @"Nim game"
|
||||
|
||||
int tokens = 12
|
||||
while ( tokens != 0 )
|
||||
print @"Tokens remaining: ";tokens
|
||||
CFStringRef num = inkey @"Take 1 to 3 tokens", @"123"
|
||||
if ( !num ) then end
|
||||
|
||||
int n = intval(num)
|
||||
|
||||
print @"You took ";n; @" token";
|
||||
if ( n > 1 ) then print @"s" else print
|
||||
tokens -= n
|
||||
|
||||
int c = 4-n
|
||||
|
||||
print @"I took ";c;@" token";
|
||||
if ( c > 1 ) then print @"s" else print
|
||||
|
||||
tokens -= c
|
||||
print
|
||||
wend
|
||||
|
||||
print @"I win!"
|
||||
end fn
|
||||
|
||||
fn NimGame
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue