j*x 发帖数: 425 | 1 public class TicTacToe {
int[][] board;
int[] hScore;//horizontal
int[] vScore;//vertical
int[] dScore;//diagnal
public TicTacToe(int n){
board=new int[n][n];
hScore=new int[n];
vScore=new int[n];
dScore=new int[2];
}
public void addMove(char c,int i,int j){
board[i][j]=c;
int n=board.length;
if(c=='X'){
hScore[i]-=1;
vScore[j]-=1;
if(i==j) dScore[0]-=1;
if(... 阅读全帖 |
|