Question: Please help me write this in Python: 5 Program Requirements 5 . 1 Board Representation Throughout these functions, the board will be represented by a
Please help me write this in Python:
Program Requirements
Board Representation
Throughout these functions, the board will be represented by a list of lists. An empty
spot will have a a spot with a Black Stone will have a and a spot with a White Stone
will have a You may assume that the board will be a Rectangle.
The Black player will be represented by the int and the White player by the int
A jump will be a Tuple of two Tuples, where each nested Tuple will have two integers:
a row and a column in that order.
TupleTupleint int Tupleint int
The first Tuple will be the starting position of the stone, and the second Tuple will be
the ending position of the Stone.
TupleStart End
Functions
There are two documents that contain examples of function calls. Examples for moves
and players can be found here, and an example of preping the board can be found here.
These are not meant to be exhaustive, they are just a subset of examples.
generateboardanint
This function should take a single integer. While all of the other functions you write
must assume a rectangular board, you may assume that this specific function will always be
used to generate Square Boards. Therefore the integer passed is both the height and width.
The function should return a list of lists, filled in such that the item at position is
a and the remainder of the spots are filled in with alternating colors.
If the user uses a zero or negative value, return an empty list.
generateboard
generateboard
generateboard
generateboardranintrow, anintcol
This function should take two integers. The first should be the number of rows the
board should have; the second should be the number of columns the board should have.
This function should return a list of lists, filled in such that position is a and the
remainder of the spots are filled in with alternating colors. Return an empty list if the user
uses a zero or negative value.
generateboard
getboardasstringboard
You must include a function that returns the current board state as a string. Each "cell"
in the board should be represented in the following format, When no one has played in that
square the cell should be empty. If that the spot has a white token it should be the white
token is Unicode UCB A black token should be the black token is Unicode UCF
a An Empty Cell b A White Cell c A Black Cell
Adjacent cells should share borders. For example
Figure : Four Cells in a square
A board should display all the cells with indicators for column and row indices Zero
based indexing
If the indexes of the columns or rows are or larger, the index should be printed modulo
For the board layout for the to string function, each row should start with a number,
followed by a space, followed by Which means that the "Lines" separating rows of the
form should start with two space characters.
The following are two examples of a full board
a Full times board b Full times board
Figure : Two Examples of a Full Board.
prepboardhumanboard
This function should print the board as a string, then prompt the user to enter two row
and column locations and remove the token at those two locations. The two locations must
be of different colors, and if the same color is picked twice the user should be reprompted.
Additionally, both of the selected tokens must not be on the boards edge. You may not
assume which color stone will be picked first and which color stone will be picked second.
You can see some examples of this function here.
This function should return None. It should mutate the passed in board.
This is the same link from the Functions section.
isvalidmoveboard move
This function will accept two arguments, a board and a movejump as defined in section
It will return True if the move is valid and False if the move is invalid. While
the description of this function is simple, the actual implementation requires a number of
different checks you w
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
