Question: Write a program to Simulate a game of tic tac toe . A game of tic tac toe has two players. A Player class is required to store /represent information about each player. The UML diagram is...


Question:


Write a program to Simulate a game of
tic tac toe. A game of
tic tac toe
has two players. A Player class is required to store /represent information about each player. The UML diagram is given below.















Player



-name: string


-symbol :char



Player (name:string,symbol:char)


getName():string


getSymbol():char


getInfo():string









The
tic tac toe
board will be represented by a two dimensional array of size 3 by 3 characters. At the start of the game each cell is empty (must be set to the underscore character ‘_’).



Program flow:



  • Your program must ask for each player’s name and their special symbol or character (usually an ‘X’ or ‘O’).

  • Display each player’s name and symbol.

  • The program must then display the board (the 2 dimensional array).

  • The player whose turn it is has their name displayed and is asked for a row and column number to place their symbol. They can enter -1 -1 as the row and column number to quit.

  • Repeat 2 and 3 until one player enters -1 -1.



Your program does not have to detect if the game is won. It simply allows the players to place symbols on the board.




Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here