Reap what you sowed def oware_move(board, house): The African board game of Oware is one of the most popular Mancala variations. After appreciating the simple structure of sowing games that allows games of such emergent complexity to be played with minimal equipment amply available practically everywhere on this planet, we first naturally generalize the game mechanics of Oware for arbitrary k houses per player with any number of seed. As interesting as the discrete mathematics and game theoretical aspects of these games would be for a later course, we shall content ourselves with capturing (heh) the mechanics of executing a single move. The minimax function that chooses the best move among the legal moves will have to wait until the course CCPS 721 Artificial Intelligence. The board is a list with 2k elements, the first k representing the houses of the current player and the last k representing those of the opponent. (The stores that keep track of captured stones do not appear anywhere in this list.) This function should return the outcome of picking up the seed from the given house on your side (numbering of houses here starts from zero) and sowing them counterclockwise around the board. The original house is skipped during sowing if that house originally hold enough seed to make this sowing process to come around a full lap. After sowing, capturing starts from the house that the last seed was sown into, and continues backwards as long as the current house is on the opponent’s side and contains two or three seed. To keep this problem simple, we ignore the edge situations that stem from the grand slam rule and the gentlemanly requirement to leave at least one seed so that the opponent can move.
Reap what you sowed
def oware_move(board, house):
The African board game of Oware is one of the most popular Mancala variations. After appreciating the simple structure of sowing games that allows games of such emergent complexity to be played
with minimal equipment amply available practically everywhere on this planet, we first naturally generalize the game
As interesting as the discrete mathematics and game theoretical aspects of these games would be for a later course, we shall content ourselves with capturing (heh) the mechanics of executing a
single move. The minimax function that chooses the best move among the legal moves will have to wait until the course CCPS 721
The board is a list with 2k elements, the first k representing the houses of the current player and the last k representing those of the opponent. (The stores that keep track of captured stones do not
appear anywhere in this list.) This function should return the outcome of picking up the seed from the given house on your side (numbering of houses here starts from zero) and sowing them
counterclockwise around the board. The original house is skipped during sowing if that house originally hold enough seed to make this sowing process to come around a full lap.
After sowing, capturing starts from the house that the last seed was sown into, and continues backwards as long as the current house is on the opponent’s side and contains two or three seed. To
keep this problem simple, we ignore the edge situations that stem from the grand slam rule and the gentlemanly requirement to leave at least one seed so that the opponent can move.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps