130k views
4 votes
First, the chooseMove function should declare an array of the SortableMove type to hold all the possible moves that are valid. Declare a constant for the array size. The constant should be equal to the number of places on the game board plus 1 (for passing). This constant says the maximum number of moves that will ever be stored in the array. You will also need a variable to store how many moves are currently stored in the array. It should start at 0.

User Chilli
by
8.1k points

1 Answer

0 votes

Final answer:

The student is asked to declare an array to record possible game moves, with a size constant reflecting the game board plus one for a 'pass' action, and a variable to track the number of moves stored, initially zero.

Step-by-step explanation:

The student's question deals with declaring an array to hold potential moves in a game, indicative of tasks related to programming, which falls under the subject of Computers and Technology. For the array, you would declare a constant representing the size of the game board plus an additional space for the move 'pass'.

This constant will dictate the maximum number of moves the array can contain. You would also need a variable to keep track of the current number of moves in the array. This variable should initially be set to 0. Here's a potential way to start this in a generic programming language:

const int MAX_MOVES = GAME_BOARD_SIZE + 1;
SortableMove possibleMoves[MAX_MOVES];
int currentNumberOfMoves = 0;

Replace GAME_BOARD_SIZE with the actual size of your game board. This array of type SortableMove and the counter variable will help manage the game's logic for determining and storing valid moves.

User Brandon Zamudio
by
8.5k points