Question: Please complete the functions: Please only write where it is specified in bold. # The next several lines contain constants for you to use in
Please complete the functions:
Please only write where it is specified in bold.
# The next several lines contain constants for you to use in your code. # You must use these constants instead of the values they refer to. # For example, use BLACK_SQUARE instead of '#'. # You may not need to use all of the constants provided. # Do not change the values these constants refer to.
N_COLUMNS = 5 # Number of columns in the game board N_ROWS = 4 # Number of rows in the game board
BLACK_SQUARE = '#' # The character that represents a black square RED_SQUARE = 'R' # The character that represents a red square YELLOW_SQUARE = 'Y' # The character that represents a blue square
ACROSS = 'across' # The horizontal direction DOWN = 'down' # The vertical direction DOWN_RIGHT = 'dright' # The diagonal direction: downward and rightward DOWN_LEFT = 'dleft' # The diagonal direction: downward and leftward
# This function is completed for you as an example and you must not change it. def create_empty_board() -> str: """Return a string representation of a game board of all empty symbols with N_ROWS rows and N_COLUMNS columns. """ return BLACK_SQUARE * N_ROWS * N_COLUMNS
def is_board_full(game_board: str) -> bool: """Return True if and only if the game_board is full.
A game_board is full when it does not contain any BLACK_SQUARE characters.
>>> is_board_full('R########YR####Y####') False >>> is_board_full('RYYRYYRYYRYYRYYRYYRY') True """ # Write your code for the is_board_full function here
def between(value: str, min_value: int, max_value: int) -> bool: """Return True if and only if value is between min_value and max_value, inclusive.
Preconditions: - value can be converted to an integer without error - min_value <= max_value
>>> between('2', 0, 2) True >>> between('0', 2, 3) False """ # Write your code for the between function here.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
