TicTacToe in BlueJ
TicTacToe in BlueJ
*;
public class TicTacToe
{
char a[][]=new char[3][3];
int p=0;char nn;
public void Board()
{
for(int i=0;i<3;i++)
{
System.out.println(" | | ");
System.out.println(" "+a[i][0]+" | "+a[i][1]+" | "+a[i][2]);
if(i!=2)
System.out.println("___|___|___");
else System.out.println(" | | ");
}
}
void com()
{char x;
if(check('O',2))
assign(nn,'O');
else if(check('X',2))
assign(nn,'O');
else
do
{
x=(char)((int)(Math.random()*9)+48);
}while(assign(x,'O')==false);
}