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 tic-tac-toe 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 (human/computer) 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 validMove(GameState 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 findBestMove(GameState 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 tic-tac-toe. 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(0,0);
game.play(1,1);
cout << game << endl;
return 0;
}
GameState.h code:#ifndef GAME_STATE_H
#define GAME_STATE_H
#include
struct Vec{
int x;
int y;
Vec(){
x =0;
y =0;}
Vec(int x, int y){
this->x = x;
this->y = y;}
void set(int x, int y){
this->x = x;
this->y = y;}};

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!