Hi , I just had a homework to get done before tomorrow to create a KALAH GAME Player 1 Vs Player 2 : I struggle with the two last 5 and 6.

1. Two players Player1 and Player2 each have in front of them, six stacks full of a
equal number of coins and an empty stack called its "Kalah". The whole is arranged in
the following way (e.g. with three pieces in each stack) :
2. The object of the game is for each player to gradually bring in their
kalah more than half the pieces of the game. The game also ends if all
a player's stacks are empty when it's his turn to play. The other player
then collects his own coins in his kalah.
3. A move is played as follows:
The player chooses one of his stacks (not empty) and takes in the hand all the pieces in his kalah.
pieces in this stack,
Then the player turns in the trigonometric direction above the game, in
starting from the stack next to the one he just emptied, and dropping down to
depletion of one coin in each stack, including in his kalah (but not in his kalah)
in his opponent's).
If the last piece lands in his kalah, he plays again immediately.
If it lands in one of his empty stacks, he captures the pieces that are in
the opponent's pile facing that empty pile and puts them in his kalah,
as well as his own last piece.
In all other cases the opponent plays in turn.
4. 4. The program must allow the management of a game between two players.
human (the program is not asked to be able to simulate a player). It
will need to know how many pieces to fill the stacks at the beginning of the game.
(it's up to the programmer to set the limits). The program will randomly draw which of the
two players start. He will distribute the pieces in a stack x
when a player decides to play a valid stack x, and will take into account the
different rules. It will have to detect the end of the game and display the player's name.
who wins, etc.
5. We should be able to save a game in progress just as we will be able to save a game in progress.
recall a previously saved one.
6. Finally, the cancellation of the moves played will be authorized in order to be able to come back in the same position.
back