Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
29
Task/Nim-game/XPL0/nim-game.xpl0
Normal file
29
Task/Nim-game/XPL0/nim-game.xpl0
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
func ShowTokens(Tokens);
|
||||
int Tokens;
|
||||
[Text(0, "Tokens remaining: ");
|
||||
IntOut(0, Tokens);
|
||||
CrLf(0); CrLf(0);
|
||||
];
|
||||
|
||||
int Tokens, T, CT;
|
||||
[Tokens:= 12;
|
||||
loop [ShowTokens(Tokens);
|
||||
Text(0, " How many Tokens (1, 2 or 3)? ");
|
||||
T:= IntIn(0);
|
||||
if T < 1 or T > 3 then
|
||||
Text(0, "^m^jMust be a number between 1 and 3. Try again.^m^j^m^j")
|
||||
else [CT:= 4 - T;
|
||||
Text(0, " Computer takes ");
|
||||
IntOut(0, CT);
|
||||
Text(0, " token");
|
||||
if CT # 1 then ChOut(0, ^s);
|
||||
Text(0, ".^m^j^m^j");
|
||||
Tokens:= Tokens - 4;
|
||||
];
|
||||
if Tokens = 0 then
|
||||
[ShowTokens(0);
|
||||
Text(0, " Computer wins!^m^j");
|
||||
return;
|
||||
];
|
||||
];
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue