Question: C++ Part B: The Game Board (25% = 20% test program + 2% output + 3% code] In Part B, you will create functions related

C++ Part B: The Game Board (25% = 20% test program +C++

Part B: The Game Board (25% = 20% test program + 2% output + 3% code] In Part B, you will create functions related to the board itself. Put the function prototypes in a file named Board.h and the function implementations in a file named Board.cpp. By the end of Part B, you will have functions with the following prototypes: . . void boardinit (Board board); int boardGetAt (const Board board, int row, int column); void boardSetAt (Board board, int row, int column, int value); . . void boardprint (const Board board); In Part E, you will add helper functions with the following prototypes: . void boardprintColumnNameRow (); void boardPrintBorderRow (); void boardPrintEmptyRow(); void boardPrintDataRow (const Board board, int row); . Perform the following steps: 1. In Board.cpp, use #include to include the library, "BoardSize.h", and "Board.h". Remember to put using namespace std;. 2. In Board.h, use typedef to define a Board type corresponding to a 2D array of chars with dimensions BOARD_SIZE and BOARD_SIZE. The typedef uses the BOARD_SIZE constant, so Board.h should #include "Boardsize.h". 3. In Board.h, copy in the function prototypes shown above. 4. In Board.cpp, add an implementation for the boardInit function that sets all the elements of the array. The values should depend on the array position, as described in The Game Board above. You must use at least two loops in the implementation. . Hint: Use a pair of nested for loops for the initialization. Hint: Start by initializing all the elements of the board to the same value, such as 1. Then, after that works, change your function to set them to the correct values. Hint: The abs function from the library returns the absolute value of a variable. So abs (v - MIDDLE) will return how far v is from MIDDLE. It will help you to figure out how far you are from the middle of the array. 5. Add an implementation for the boardGetAt function that returns the amount of money at the specified position. The function must determine the value from the array. 6. Add an implementation for the boardSetAt function that sets the amount of money at the specified array position to the specified value. 7. Add an implementation for the boardprint function that prints the array contents in the first (simpler) format shown under The Game Board above. The four functions named boardprint* listed above will be used in Part E to print the board in the second format. Note: The * in boardprint* is a common computer science convention for "anything". So boardprint* means boardprintColumnNameRow, boardPrintBorderRow, boardPrintEmptyRow, and boardPrintDataRow. You can use the same syntax on Hercules (or any similar system) when entering commands. For example, g++ -c *.cpp will compile all the files in the current directory that have a .cpp extension

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!