char * tictactoe(int** moves, int movesSize, int* movesColSize){ int hash[2][8]={0},i; char* s[] = {"A","B"}; for (i=0; i<movesSize; i++) { //累计行子 hash[i%2][moves[i][0]]++; //累计列子 hash[i%2][moves[i][1]+3]++; //累计主对角线 if (moves[i][0] == moves[i][1]) hash[i%2][6]++; //累计副对角线 if (moves[i][0] + moves[i][1] == 2) hash[i%2][7]++; if (hash[i%2][moves[i][0]]==3 || hash[i%2][moves[i][1]+3]==3 || hash[i%2][6]==3 || hash[i%2][7]==3) return s[i%2]; } return (i==9)? "Draw": "Pending"; }