Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
|
|
@ -1,20 +1,20 @@
|
|||
nim :- next_turn(12), !.
|
||||
|
||||
next_turn(N) :-
|
||||
% Player Turn
|
||||
format('How many dots would you like to take? '),
|
||||
read_line_to_codes(user_input, Line),
|
||||
number_codes(PlayerGuess, Line),
|
||||
member(PlayerGuess,[1,2,3]),
|
||||
N1 is N - PlayerGuess,
|
||||
format('You take ~d dots~n~d dots remaining.~n~n', [PlayerGuess, N1]),
|
||||
% Player Turn
|
||||
format('How many dots would you like to take? '),
|
||||
read_line_to_codes(user_input, Line),
|
||||
number_codes(PlayerGuess, Line),
|
||||
member(PlayerGuess,[1,2,3]),
|
||||
N1 is N - PlayerGuess,
|
||||
format('You take ~d dots~n~d dots remaining.~n~n', [PlayerGuess, N1]),
|
||||
|
||||
% Computer Turn
|
||||
CompGuess is 4 - PlayerGuess,
|
||||
N2 is N1 - CompGuess,
|
||||
format('Computer takes ~d dots~n~d dots remaining.~n~n', [CompGuess, N2]),
|
||||
(
|
||||
N2 = 0
|
||||
-> format('Computer wins!')
|
||||
; next_turn(N2)
|
||||
).
|
||||
% Computer Turn
|
||||
CompGuess is 4 - PlayerGuess,
|
||||
N2 is N1 - CompGuess,
|
||||
format('Computer takes ~d dots~n~d dots remaining.~n~n', [CompGuess, N2]),
|
||||
(
|
||||
N2 = 0
|
||||
-> format('Computer wins!')
|
||||
; next_turn(N2)
|
||||
).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue