Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
24
Task/Nim-game/PascalABC.NET/nim-game.pas
Normal file
24
Task/Nim-game/PascalABC.NET/nim-game.pas
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
##
|
||||
writeln('There are twelve tokens.');
|
||||
writeln('You can take 1, 2, or 3 on your turn.');
|
||||
writeln('Whoever takes the last token wins.');
|
||||
|
||||
var tokens := 12;
|
||||
|
||||
while (tokens > 0) do
|
||||
begin
|
||||
writeln('There are ' + tokens + ' remaining.');
|
||||
writeln('How many do you take?');
|
||||
var playertake := ReadInteger;
|
||||
|
||||
if (playertake < 1) or (playertake > 3) then
|
||||
writeln('1, 2 or 3 only.')
|
||||
else
|
||||
begin
|
||||
tokens -= playertake;
|
||||
writeln('I take ' + (4 - playertake) + '.');
|
||||
tokens -= (4 - playertake);
|
||||
end;
|
||||
end;
|
||||
|
||||
writeln('I win again.');
|
||||
Loading…
Add table
Add a link
Reference in a new issue