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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education