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 23:30
Acomputer is a multipurpose device that accepts input, processes data, stores data, and produces output, all according to a series of stored . the processing unit of most modern computers is a(n) . the instructions that tell a computer how to carry out a task are referred to as computer , which are distributed as software. computers run three main types of software: software, system software, and development tools. an example of system software is a computer system, which is essentially the master controller for all the activities that a digital device performs. digital devices are constructed using tiny electronic components that represent data bits as electrical signals. the system unit houses the system board, which contains several circuits made from semiconducting materials. computers come in three popular form factors: component, , and slate. many of today's digital devices operate on battery power supplied by ion batteries. battery life and lifespan can be extended by following good battery management practices.
Answers: 3
question
Computers and Technology, 22.06.2019 01:10
When you reach a yield sign, yield to cross traffic and before you enter the intersection. a. flash your headlights b. wait for a signal c. wait five seconds d. wait for a safe gap
Answers: 1
question
Computers and Technology, 23.06.2019 06:10
The head restraint should be adjusted so that it reaches a.the top of your ears b.the base of your skull c.the top of the head
Answers: 1
question
Computers and Technology, 23.06.2019 12:00
If you embed a word table into powerpoint, what happens when you make edits to the embedded data? a. edits made to embedded data change the data in the source file; however, edits made to the source file will not be reflected in the embedded data. b. edits made to embedded data will change the data in the source file, and edits made to the source file will be reflected in the embedded data. c. edits made to embedded data don't change the data in the source file, nor will edits made to the source file be reflected in the embedded data. d. edits made to embedded data don't change the data in the source file; however, edits made to the source file will be reflected in the embedded data.
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
question
Geography, 06.07.2019 07:30
question
Mathematics, 06.07.2019 07:30
question
Mathematics, 06.07.2019 07:30
question
Mathematics, 06.07.2019 07:30
question
Mathematics, 06.07.2019 07:30
Questions on the website: 13722367