subject

Create_board(): creates a matrix that has 3 rows with the first two rows having 6 columns (to represent the pockets) and the last row having 2 columns (to represent the Mancala). The first two rows should have the value 4 in each position while the last row should be initiated at 0 for each. This function takes no arguments and returns a matrix of the specified dimensions. Note: The labels A through F should NOT be part of the nested list representing the board. The board should only contain integers representing number of stones.
Call your create_board function to create the board. Pass your board and a list of letters from A to F to the print_game_board() function. You should see output like this:
A B C D E F
4 4 4 4 4 4
0 0
4 4 4 4 4 4
The 0 on the left represents the Mancala stored in the 0 index of the third row of the game board and the 0 on the right represents the Mancala stored in the 1 index of the third row of the game board. This will make the game run smoother since the player that is represented as "0" in the Mancala indexing is also represented as "0" in the row indexing of the pockets. The same goes for the second player, but with the "1" value instead. This function should not return anything.
2. switch_player(): we will allow the players to choose their own names, but for our purposes, it is easier to think of them as number (0 and 1, for indexing purposes). We will display their names to them on the screen, but in the background, we will keep track of them based on their number. This function should take 1 argument, an integer (either 0 or 1) representing the player and should return the opposite integer (1 if 0 is entered and 0 if 1 is entered). This is a simple function, but it will make our code cleaner later. Use your constants!
get_column_choice(): this function will allow us to ask the players which pocket they want to grab stones from. Since we know which row they are grabbing from (since it is not allowed to grab stones from your opponent’s side), we only need to get the column they want. As previously stated, we are using letters to represent the columns to make it easier on the player. This function accepts the current player (should be a 0 or 1), the board, and a list of letters (the same as the list you passed to the print_game_board function) and it will return the index of the column being chosen.
The function should ask the player to enter a column letter, then it should check that the conditions listed below hold. If they don’t meet these conditions, it should ask again until it gets a valid letter, otherwise it should return the corresponding column index for that letter.
Letter entered must be on the game board. It can be lower case or upper case. (Hint: this doesn’t need to be hard coded, don’t make it harder on yourself than it has to be).
There must be stones in the pocket they chose.

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 24.06.2019 19:50, joThompson
Which is a characteristic of free and open-source software licenses? a. the source code is unavailable to everyone b. the source code is available only to the government c. the source code is available to all users d. the source code is constantly modified
Answers: 1
image
Computers and Technology, 24.06.2019 23:30, soapai
True or false when a host gets an ip address from a dhcp server it is said to be configured manually
Answers: 1
image
Computers and Technology, 24.06.2019 23:40, Salamonti
Which slide should you change so it reflects om all sides of your presentation
Answers: 1
image
Computers and Technology, 25.06.2019 00:00, jessica2138
He computer component that disperses heat from the microprocessor to the cooling fan is a cooler thermometer heat sink
Answers: 1
You know the right answer?
Create_board(): creates a matrix that has 3 rows with the first two rows having 6 columns (to repres...

Questions in other subjects:

Konu
Biology, 30.08.2019 23:30
Konu
Mathematics, 30.08.2019 23:30