Question: PLEASE FIRST READ EVERYTHING AND GIVE CORRECT ANSWERS(Coding of c++ only). THANKYOU In this assignment, you will simulate a simple board game. The board is
PLEASE FIRST READ EVERYTHING AND GIVE CORRECT ANSWERS(Coding of c++ only). THANKYOU
In this assignment, you will simulate a simple board game. The board is a grid, and starts with a pile of money in each cell. Players take turns rolling four dice to pick a cell, and then taking the money from there. If the cell is rolled again, the money will already be gone. The program will be divided into a main function and three supporting modules. A C++ module is a combination of a header (.h) file and a source (.cpp) file with the same base file name, e.g., Dice.h and Dice.cpp. A test program will be provided for each module. When the game runs, it will print out the board, the numbers rolled and the cell hit, and how much money the player receives. Then, the player will have the chance to quit the game. If he/she doesn't, the process will be repeated for the next player.
The main purpose of this assignment is to give you practice using two-dimensional arrays, including passing two-dimensional arrays to functions. For Part A, you will add constants and functions relating to the size of the game board. For Part B, you will add functions to handle the game board itself. For Part C, you will add constants and functions related to simulated dice. For Part D, you will use the constants and functions from Parts A, B, and C to write the game program. Then, for Part E, you will improve the display of the game board.
Another purpose of this assignment is to familiarize you with multi-file programs. To keep the assignment from getting to be too long, the files are small and the functions are mostly short. Many functions only contain a single line of code.
Warning: The test programs used in this course sometimes capture and tests the output from the cout buffer. Therefore, you must use cout to print your output. If you print it in some other way, (e.g. using printf or cerr), the test program will not see it. Then you will get a mark of zero for that portion of the assignment. Welcome to the game.
Part A: The Board Size . char getRowName (int row); . char getColumnName (int column);
Part B: The Game Board 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);
Part C: Simulated Dice
void diceInit ();
int diceRoll ();
void dicePrint2and2 (int r1, int r2, int c1, int c2);
Part D: The Game In Part D, you will make a simple game using the modules from Parts A, B, and C. The game will consist of a main function in its own file named Main.cpp. Part E: Improved Game Board Display
void boardPrintColumnNameRow ();
void boardPrintBorderRow ();
void boardPrintEmptyRow ();
void boardPrintDataRow (const Board board, int row);
OUTPUT SHOULD LOOK LIKE THIS:
0 1 2 3 4 5 6 +-------------------------------------+ | | A | $1 $1 $1 $1 $1 $1 $1 | A | | B | $1 $2 $2 $2 $2 $2 $1 | B | | C | $1 $2 $3 $3 $3 $2 $1 | C | | D | $1 $2 $3 $4 $3 $2 $1 | D | | E | $1 $2 $3 $3 $3 $2 $1 | E | | F | $1 $2 $2 $2 $2 $2 $1 | F | | G | $1 $1 $1 $1 $1 $1 $1 | G | | +-------------------------------------+ 0 1 2 3 4 5 6
Player 0's turn:
Row Column +---+ +---+ +---+ +---+ | 0 | | 2 | | 3 | | 3 | +---+ +---+ +---+ +---+
Rolled cell: C6 Money: $0 + $1 = $1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
