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.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter2: Problem Solving Using C++using
Section2.3: Data Types
Problem 9E: (Practice) Although the total number of bytes varies from computer to computer, memory sizes of...
icon
Related questions
Question

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.

board
house Expected result
[0, 2, 1, 2]
1
[0, о, 0, о]
[2, 0, 4, 1, 5, 3]
[0, 1, 5, 1, 5, 3]
[4, 4, 4, 4, 4, 4, 4,
4]
2
[4, 4, 0, 5, 5, 5, 5, 4]
[10, 10, 10, 10]
[0, 14, 13, 13]
[4, 10, 4, 1, 1, 1, 4, 4] |1
[5, 0, 6, 3, о, 2, 5, 5]
[4, 5, 1000, 1, 2, 3]
2
[204, 205,
0, 201, 202, 203]
[0, о, 0, 6, 1, 1, 2, 1,
2, 1]
[0, 0, 0, о, 2, 0, 0, о, о,
0]
3
Transcribed Image Text:board house Expected result [0, 2, 1, 2] 1 [0, о, 0, о] [2, 0, 4, 1, 5, 3] [0, 1, 5, 1, 5, 3] [4, 4, 4, 4, 4, 4, 4, 4] 2 [4, 4, 0, 5, 5, 5, 5, 4] [10, 10, 10, 10] [0, 14, 13, 13] [4, 10, 4, 1, 1, 1, 4, 4] |1 [5, 0, 6, 3, о, 2, 5, 5] [4, 5, 1000, 1, 2, 3] 2 [204, 205, 0, 201, 202, 203] [0, о, 0, 6, 1, 1, 2, 1, 2, 1] [0, 0, 0, о, 2, 0, 0, о, о, 0] 3
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Computational Systems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr