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

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 20:20
Sometimes writers elaborate on the truth when recalling past events so they can enhance their narrative essay with more interesting descriptions. do you feel that published writers should or should not embellish real life events just to make their stories more interesting?
Answers: 2
question
Computers and Technology, 23.06.2019 00:30
Quic which one of the following is the most accurate definition of technology? a electronic tools that improve functionality b electronic tools that provide entertainment or practical value c any type of tool that serves a practical function d any type of tool that enhances communication
Answers: 1
question
Computers and Technology, 23.06.2019 18:50
What is transmission control protocol/internet protocol (tcp/ip)? software that prevents direct communication between a sending and receiving computer and is used to monitor packets for security reasons a standard that specifies the format of data as well as the rules to be followed during transmission a simple network protocol that allows the transfer of files between two computers on the internet a standard internet protocol that provides the technical foundation for the public internet as well as for large numbers of private networks
Answers: 2
question
Computers and Technology, 24.06.2019 11:00
The program below has been generalized to read a user's input value for hourlywage. run the program. notice the user's input value of 10 is used. modify that input value, and run again. generalize the program to get user input values for workhoursperweek and workweeksperyear (change those variables' initializations to 0). run the program. monthsperyear will never change, so define that variable as final. use the standard for naming final variables. ex: final int max_length
Answers: 2
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
question
Mathematics, 11.04.2020 00:03
Questions on the website: 13722360