Quote:If I was you, I would simply use this function to check the winner. checkWin(char player) where player is refer to character of each player.
[Snip DailyWTF submission]
* Dies of heart attack *
At least pretend to remove repetitiveness:
int checks[][3] = { {0,1,2}, {3,4,5}, {6,7,8}, {0,3,6}, {1,4,7}, {2,5,8}, {0,4,8}, {2,4,6} }; for (int i = 0; i < 8; ++i) { bool row_full = true; for (int j = 0; j < 3; ++j) { row_full = row_full && (player == board[checks[j] / 3][checks[j] % 3]); } if (row_full) return true; } return false;