Version Three:
1. Maintains features of versions one and two
2. Computer generates random moves
Try forcing a cat's game!
Methods added to TicTacToe.java
public void computer_move() { int j=0; int i=0; do{ j= Math.abs(r.nextInt())%3; i= Math.abs(r.nextInt())%3; } while(position[j][i] != EMPTY); position[j][i]=COMPUTER; win(); TURN=HUMAN; } public void human_move(int x, int y) { if(position[x][y]==EMPTY) { position[x][y]=HUMAN; win(); TURN=COMPUTER; } } }