Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Make a Super Tic Tac Toe game based on this skeleton code. Thanks #include #include using namespace std; /* Check whether there's a a horizontal,

Make a Super Tic Tac Toe game based on this skeleton code. Thanks

#include  #include  using namespace std; /* Check whether there's a a horizontal, vertical, or diagonal row marked * Parameter: player - player id, 1 or 2 * board[][] - a 3x3 board * Return: true - if the player win this 3x3 board * false - if not */ bool checkWin(int player, const int board[][3]){ // Please fill in your codes here. } /* Check whether the board is full or not * The game board is full is all its grids are marked * Parameter: board[][] - a 3x3 board * Return: true - if all grids are not equal to 0 * false - if there exists at least one grid that's equal to 0 */ bool isBoardFull(const int board[][3]){ // Please fill in your codes here. } /* Check whether the input position x, y are valid or not * Valid means 1 - x, y are within the boundary * 2 - this position in the game board is empty (equal to 0) * Parameter: x, y - position the player want to choose * lower_x, upper_x, lower_y, upper_y - the boundary that x, y cannot exceed * board[][] - the whole 9x9 game board * Return: true - if x, y satisfy both requirements * false - if x, y violate at least one requirement */ bool isInputValid(int x, int y, int lower_x, int upper_x, int lower_y, int upper_y, const int board[][9]){ // Please fill in your codes here. } /* This function is used to decide which super grid player can mark given his/her opponent's move * The player can only mark 1 - the super grid with bottem left and top right boundary * 2 - anywhere unoccupied if the super grid has been marked * Parameter: superBoard - the 3x3 super tic tac toe x, y - position the opponent mark on the game board * lower_x, lower_y - the bottom left boundary the player can mark * upper_x, upper_y - the top right boundary the player can mark * Return: No Return but should change lower_x, lower_y, upper_x and upper_y */ void updateBoundary(const int superBoard[][3], int x, int y, int& lower_x, int& lower_y, int& upper_x, int& upper_y){ // Please fill in your codes here. } // This function is used to visualize the board, // as ' ' denote empty, 'X' - player 1, '0' - player 2, '#' denote this part draw for both players. void printBoard(const int board[][9], int boardsize){ // symbol used in the game // ' ' - empty grid, 'X' - player 1, '0' - player 2, '#' - draw const char symbol[4] = {' ', 'X', 'O','#'}; int i, j; cout> x >> y; while(!isInputValid(x, y, lower_x, upper_x, lower_y, upper_y, board)){ cout > x >> y; } // Mark this grid. board[x][y] = player; // Copy the enclosing super grid to temp board for(i = 0; i  

Sample output should be like this

image text in transcribed

(range [0,2] [6,8]) Player 2's move: (0) Please give the grid position(row column): 07 Player 2 has dominated this region! 0 1 2 3 4 5 6 7 8 |------ 1. -1- -----| 01 | 1000L 11 I 10001 21 10001 1- 31 41 51 XL XL X 61 71 8

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

Define the term Working Capital Gap.

Answered: 1 week ago

Question

How would you describe your typical day at work?

Answered: 1 week ago