Right now I have a program that will play tic tac toe between 2 people, but I am confused on how to turn it into a program that plays between the computer and the player. The computer doesn't have to be smart. import java.io.*; import java.util.*; class TTT { public static void main(String args[]) { int a,b,x,y; int person,row,col,count=0; char pl; char[][] array= { {' ',' ',' '}, {' ',' ',' '}, {' ',' ',' '}, }; do { for(a=0;a<4;a++) { System.out.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); for(b=0;b<2;b++) { if(b==1) { pl='O'; } else { pl='X'; } if(b==1) { person=1; } else { person=2; } System.out.println(" 0 1 2"); for(x=0;x<3;x++) { System.out.print(x); for(y=0;y<3;y++) { System.out.print("["+array[x][y] +"]"); } System.out.println(); } boolean invalidcoordinates = false; do{ count=count+1; System.out.println("Enter Row(0,1,2)"); Scanner scan = new Scanner(System.in); row=scan.nextInt(); System.out.println("Enter Column(0,1,2)"); col=scan.nextInt();
*not all of code*
2007-03-17
20:41:36
·
3 answers
·
asked by
Anonymous
in
Programming & Design