Question: Create a new class to make the code below work to aid a two player tic tac toe game. _ _ _ _ _ _
Create a new class to make the code below work to aid a two player tic tac toe game.
private static void playGameScanner keyboard
char p X;
TicTacToe ttt new TicTacToe;
int r c;
do
System.out.printlnttt;
do
System.out.print p choose your location row column: ;
try
r keyboard.nextInt;
c keyboard.nextInt;
if tttisValidr c
System.out.printlnThat is not a valid location. Try again.";
else if tttplayerAtr c
System.out.printlnThat location is already full. Try again.";
else
break;
catch Exception e
System.out.printlnBad Integer Entered. Try Again.";
keyboard.nextLine;
while true;
tttplayMovep r c;
if p X
p O;
else
p X;
while tttisWinnerX && tttisWinnerO && tttisFull;
System.out.printlnttt;
String status;
if tttisWinnerX
status X is the winner!";
else if tttisWinnerO
status O is the winner!";
else
status "The game is a tie.";
status After tttgetTurns plays.";
System.out.printlnstatus;
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
