Question: Coding for this two-dimensional board. The game board has a number of rows and columns specified at the beginning of the game and starts off
Coding for this
two-dimensional board. The game board has a number of rows and columns specified at the beginning of the game and starts off filled with black squares. The following image is an example of a game board with 4 rows and 5 columns:
Each player has an infinite number of squares in one colour (e.g., one player has red squares; the other player has yellow squares). There are two moves that a player can make to get their squares onto the game board:
- Slide Right
- Slide Left
The first player to place NUM_MATCH of their squares in a straight line wins the game. Here, NUM_MATCH is a number like 3. The "straight line" can be a horizontal, vertical, or diagonal line of squares on the game board.
Function: calculate_increment(str) -> int
Specification: This function has one parameter. The parameter refers to a string that describes one of the four directions: down, across, down-right, or down-left. Assume that the str value is one of: DIR_DOWN, DIR_ACROSS, DIR_DOWN_RIGHT, or DIR_DOWN_LEFT. The game board size is given by the constants NUM_ROW and NUM_COL. This function returns the difference between the str indices of two adjacent squares on a line that goes in the direction specified by the first parameter.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
