17F-8177_Lab2_ooad
17F-8177_Lab2_ooad
package tic_tac_toe;
import java.util.Scanner;
public class hello {
for(int i=0;i<=2;i++)
{
for(int j=0;j<=2;j++)
{
gameboard [i][j]='-';
}
}
while (!gameEnded)
{
PrintingGameBoard(gameboard);
char symbol=' ';
if(player1_turn)
{
symbol='X';
}
else
{
symbol='O';
}
if(player1_turn) {
System.out.print(player1 + "'s turn: ");
}
else {
System.out.print(player2+ "'s turn: ");
}
int col=0;
int row=0;
while (true)
{
System.out.print("choose a row please from the following: (0,1,2):");
row = in.nextInt();
System.out.print("choose a column from the following:(0,1,2):");
col = in.nextInt();
gameboard[row][col]=symbol;
PrintingGameBoard(gameboard);
return '-';
}
}
System.out.println();
}
}
}
SCREENSHOTS: