Question: Create a fully working tic - tac - toe game in c + + . It should have the following features: Ability to play against
Create a fully working tictactoe game in c It should have the following features:
Ability to play against another human player
Ability to play against a weak computer player
Ability to play against a more sophisticated computer player
Requirements
There must be a menu, where users can select options, similar to the one shown in lectures. The options should include a choice of opponent humancomputer and computer opponent difficulty level.
The game should use the GameState object provided to store state.
The simple computer player should be a function with the following signature: Vec validMoveGameState game; where Vec is a struct that holds two integers, one for row and one for column. This represents the position in the grid where the player whose turn it is should play.
The sophisticated player should be a function: Vec findBestMoveGameState game possibly with additional parameters which should all have default values, so that the function can be called with only a GameState object.
The sophisticated player should be unbeatable. That is to say, it can not be beaten in a game of tictactoe. It does not have to always win, but it should never lose. If playing against a competent player, games should generally end in a draw.
main.cpp code:#include
#include "GameState.h
using namespace std;
int main
GameState game;
game.play;
game.play;
cout game endl;
return ;
GameState.h code:#ifndef GAMESTATEH
#define GAMESTATEH
#include
struct Vec
int x;
int y;
Vec
x ;
y ;
Vecint x int y
thisx x;
thisy y;
void setint x int y
thisx x;
thisy y;;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
