Question: My CODE WILL NOT COMPILE! HELP!ASAP. I need help with this tic tac toe game that's 4X4. I HAVE MY CODE PROVIDED BELOW. THANKS! MESSAGE:
My CODE WILL NOT COMPILE! HELP!ASAP. I need help with this tic tac toe game that's 4X4. I HAVE MY CODE PROVIDED BELOW. THANKS!

MESSAGE: THIS is WHAT IT SAYS: 1>------ Build started: Project: HW_OFFICIAL, Configuration: Debug Win32 ------ 1>main.obj : error LNK2019: unresolved external symbol "void __cdecl mark(struct ticTacToeBoard &,int,int)" (?mark@@YAXAAUticTacToeBoard@@HH@Z) referenced in function _main 1>C:\Users\tar\source epos\HW_OFFICIAL\Debug\HW_OFFICIAL.exe : fatal error LNK1120: 1 unresolved externals 1>Done building project "HW_OFFICIAL.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
//the given header file which is not suppose to be modified at all.
struct ticTacToeBoard { int curr_player; int points[4*4]; };
void printBoard(ticTacToeBoard board); void initBoard(ticTacToeBoard& board); bool isEmpty(ticTacToeBoard board, int x, int y); void mark(ticTacToeBoard& board, int x, int y); bool boardFull(ticTacToeBoard board); int winner(ticTacToeBoard board);
//main.cpp that was given
#include
int main() { ticTacToeBoard b1; initBoard(b1); printBoard(b1); int x, y; //while board is not full while (!boardFull(b1)) { //Ask for current player to make move if (b1.curr_player == 1) cout > x; cin >> y; //if move out of bound, get input agin if ( !((1
} //We're done either because there's a winner //or because the board is full. if (winner(b1)==1) cout
// mycpp file
#include "ticTacToeBoard.h" #include
//printBoard() definition void printBoard(ticTacToeBoard board) { for (int y=0; y
cout
//initBoard() definition void initBoard(ticTacToeBoard& board) { board.curr_player = 1; for (int x = 0; x
//isEmpty() definition bool isEmpty(ticTacToeBoard board, int x, int y) { return board.points[(x - 1) * 4 + (y - 1)] == 0; }
//marker() definition void marker(ticTacToeBoard& board, int x, int y) { if (isEmpty(board, x, y)) { board.points[(x - 1) * 4 + (y - 1)] = board.curr_player; } }
//boardFull() definition bool boardFull(ticTacToeBoard board) { for (int x = 0; x
//winnerHelper() definition bool winnerHelper(ticTacToeBoard board, int player) { for (int x = 0; x
//winner() definition int winner(ticTacToeBoard board) { if (winnerHelper(board, 1)) { return 1; } if (winnerHelper(board, -1)) { return -1; } return 0; }
Download the starter code main.cpp, ticTacToeBoard.h, and ticTacToeBoard.cpp. Do not mod ify ticTacToeBoard.h. We have provided main.cpp to give you an idea of how we intend to use the functions. ticTacToeBoard.cpp must not contain a main function. You may not use global variables We may take off up to 20% of the total marks for poor style: make sure to name your variables reasonably, indent properly, and comment sufficiently. Submit ticTacToeBoard.cpp Problem 1: (Tic-tac-toe) Write the function implementations for a program that plays the Tic-tac-toe game on a 4x4 board The winner is determined by 4 consecutive marks of the same kind. Player X goes first, and player 0 goes second The struct struct ticTacToeBoard int curr_player; int points [4*4]; encodes the state of the game. curr player--1 means it's X's turn to play. curr player1 means it's O's turn to play. points [4*4] contains the moves made so far. An empty point has value 0, a point marked X has value 1, and a point marked 0 has value -1. The procedure void printBoard (ticTacToeBoard board); prints the board. The definition of printBoard is provided, and it will clarify the meaning of ticTacToeBoard. The procedure void initBoard (ticTacToeBoard& board); initializes the board. Since X goes first, initBoard must set board.curr player to 1. Since the board is empty at the beginning of the game, initBoard must set all values of the array board.points to 0 The predicate bool isEmpty (ticTacToeBoard board, int x, int y); checks if the point (x,y) is empty and therefore available to play The procedure void mark (ticTacToeBoard& board, int x, int y)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
