Write a class named FBoard for playing a game...
PLEASE USE C++
PLEASE DO NOT USE "THIS -->". NOT ALLOWED
PLEASE PROVIDE COMMENTS AND OUTPUT!


//FBoard.h
enum state{
X_WON,O_WON,UNFINISHED
};
class FBoard{
private:
char **board;
enum state gameState;
int x,y;
public:
FBoard();
enum state getGameState();
bool moveX(int ,int);
bool moveO(int ,int ,int
,int);
};
//FBoard.cpp
#include"FBoard.h"
#include<math.h>
FBoard::FBoard(){
board = new char*[8];
for(int i=0;i<8;i++)board[i] = new char[8];
for(int i=0;i<8;i++){
for(int
j=0;j<8;j++)board[i][j]='_';
}
board[7][0] = 'o';
board[7][2] = 'o';
board[7][4] = 'o';
board[7][6] = 'o';
board[0][3] = 'x';
x=0;
y=3;
gameState = UNFINISHED;
}
enum state FBoard::getGameState(){
return gameState;
}
bool FBoard::moveX(int row,int col){
if(gameState!=UNFINISHED)return false;
if(row<0||row>7||col<0||col>7||abs(row-x)!=1||abs(col-y)!=1||board[row][col]!='_'){
return false;
}
board[x][y] = '_';
board[row][col]='x';
x=row;
y=col;
if(x==7){
gameState = X_WON;
}
return true;
}
bool FBoard::moveO(int i_row,int i_col,int f_row,int
f_col){
if(gameState!=UNFINISHED){
return false;
}
if(i_row<0||i_row>7||i_col<0||i_col>7||f_row<0||f_row>7||f_col<0||f_col>7){
return false;
}
if(board[i_row][i_col]!='o'||board[f_row][f_col]!='_'){
return false;
}
if(i_row!=f_row+1||(i_col!=f_col+1 &&
i_col!=f_col-1)){
return false;
}
board[f_row][f_col] = 'o';
board[i_row][i_col] = '_';
if(board[x-1][y-1]=='o'&&board[x-1][y+1]=='o'&&board[x+1][y+1]=='o'&&board[x+1][y-1]=='o')gameState
= O_WON;
return true;
}
//main.cpp
#include<iostream>
#include"FBoard.cpp"
using namespace std;
int main(){
FBoard fb;
if(fb.moveX(1,4))cout<<"X moves to given
position\n";
else cout<<"Invalid position\n";
if(fb.moveX(2,5))cout<<"X moves to given
position\n";
else cout<<"Invalid position\n";
if(fb.moveO(7,0,6,1))cout<<"O moves to given
position\n";
else cout<<"Invalid position\n";
cout<<fb.getGameState();
return 0;
}
//sample output

Write a class named FBoard for playing a game... PLEASE USE C++ PLEASE DO NOT USE "THIS -->". NOT ALLOWED PLE...
In C++. Write a class named FBoard for playing a game, where player x is trying to get her piece to row 7 and player o is trying to make it so player x doesn't have any legal moves. It should have: An 8x8 array of char for tracking the positions of the pieces. A data member called gameState that holds one of the following values: X_WON, O_WON, or UNFINISHED - use an enum type for this, not string (the...
Tic-Tac-Toe Game Write a program that allows two players to play a game of tic-tac-toe. Use a two-dimensional char array with three rows and three columns as the game board. Each element of the array should be initialized with an asterisk (*). The program should run a loop that does the following: Displays the contents of the board array. Allows player 1 to select a location on the board for an X. The program should ask the user to enter...
18. Tic-Tac-Toe Game rite a program that allows two players to play a game of tic-tac-toe. Use dimensional char array with three rows and three columns as the game board. Each element of the array should be initialized with an asterisk (*). The program should run a loop that does the following: Write . Displays the contents of the board array. . Allows player 1 to select a location on the board for an X. The program should ask the...
Tic Tac Toe Game: Help, please. Design and implement a console based Tic Tac Toe game. The objective of this project is to demonstrate your understanding of various programming concepts including Object Oriented Programming (OOP) and design. Tic Tac Toe is a two player game. In your implementation one opponent will be a human player and the other a computer player. ? The game is played on a 3 x 3 game board. ? The first player is known as...
Using C Programming: (use printf, scanf)
18. Tic-Tac-Toc Game Write a program that allows two players to play a game of tic-tac-toc. Use a two- dimensional char array with three rows and three columns as the game board. Each element of the array should be initialized with an asterisk (*). The program should run a loop that Displays the contents of the board array Allows player 1 to select a location on the board for an X. The program should...
For this exercise, you will complete the TicTacToe Board that we started in the 2D Arrays Lesson. We will add a couple of methods to the TicTacToe class. To track whose turn it is, we will use a counter turn. This is already declared as a private instance variable. Create a getTurn method that returns the value of turn. Other methods to implement: printBoard()- This method should print the TicTacToe array onto the console. The board should include numbers that...
I need help writing a Java program for a game of TicTacToe. It is a two player game, and the rules are as follows: 1. The game begins with an empty, 3 × 3 grid. 2. The two players then take turns placing a mark in an empty grid cell. Player O will use the ‘O’ (letter ‘O’, not zero) mark and Player X will use the ‘X’ mark. Player O moves first. 3. The game is over in either...
(C++) Please create a tic tac toe game. Must write a Player class to store each players’ information (name and score) and to update their information (increase their score if appropriate) and to retrieve their information (name and score).The players must be called by name during the game. The turns alternate starting with player 1 in the first move of round 1. Whoever plays last in a round will play second in the next round (assuming there is one).The rows...
Write a JAVA program that plays a simple Pac-man game. The game plays on a 10 by 10 grid (absolutely, you can make it bigger). Pac-man is depicted as “#” and others as “*”. Please see the below. You should ask how many pac-man plays before starting the game. Then, you should create the number of pac-man objects. The pac-mans are defined as classes, and the objects are stored in an array. The pac-man class has a “move()” method, which...
Please help me write a Pseudocode (please do NOT answer in JAVA or Python - I will not be able to use those). Please ALSO create a flowchart using Flowgarithm program. Thank you so much, if answer is provided in Pseudocode and Flowchart, I will provide good feedback and thumbs up to the resonder. Thank you! Tic-Tac-Toe Game Write a program that allows two players to play a game of tic-tac-toe. Use a two- dimensional char array with three rows...