Pot-tentially the Greatest Mancala Kata
Description:
Pot-tentially the Greatest Mancala Kata
In this Kata, you will be coding the base logic for how the stone's in mancala are moved. No fancy rules like capturing involved. Simply move the stones in the right direction, and only place the stones in the scoring pot of the player that moved.
Holla for Mancala
For the complete description of mancala, I recommend you read the wikipedia page at https://en.wikipedia.org/wiki/Mancala.
The simple rundown is that there is a board with pots of stones, each pot starting with 4. Each player also has a special pot into which their stones are placed, counting as score for the player. Players take their turn by selecting a pot on their side of the board, and removing all stones from this pot.
After removing the stones, start going counter-clockwise around the board, placing a stone in each pot you pass. Do not place a stone in your opponents scoring pot, instead proceeding past it.
Your task
You will write a method called move
that takes two arguments, board
and position
.
board
is a list of the 14 pots in a standard mancala board.
# Typical starting position in mancala, in this Kata's representation
[ 0, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 0 ]
Index 0
of this list is the top player's scoring pot, and index 13
(or -1
) is the bottom player's scoring pot.
position
is the position on the board that we will be moving the stones from.
move
shall return the state of the board after the turn is concluded.
Do not concern yourself with any additional mancala rules.
Examples
Basic movement
Board
[ 0, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 0 ]
Position
5
Output
[ 0, 5, 5, 5, 5, 0, 4,
4, 4, 4, 4, 4, 4, 0 ]
Wrapping Around
Board
[ 0, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 0 ]
Position
12
Output
[ 0, 4, 4, 4, 5, 5, 5,
4, 4, 4, 4, 4, 0, 1 ]
Similar Kata:
Stats:
Created | Jan 5, 2024 |
Published | Jan 5, 2024 |
Warriors Trained | 24 |
Total Skips | 0 |
Total Code Submissions | 186 |
Total Times Completed | 14 |
Python Completions | 14 |
Total Stars | 1 |
% of votes with a positive feedback rating | 75% of 6 |
Total "Very Satisfied" Votes | 4 |
Total "Somewhat Satisfied" Votes | 1 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 6 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 6 kyu |