Skip to content

Instantly share code, notes, and snippets.

Created February 26, 2014 02:13
Show Gist options
  • Save anonymous/9222132 to your computer and use it in GitHub Desktop.
Save anonymous/9222132 to your computer and use it in GitHub Desktop.
for(int line = 0; line <= 2; line++)
{
if ((board[x][y] == board[x + 1][y + 1] && board[x][y] == board[x + 2][y + 2]) || // check forward diagonal
(board[x][y + 2]==board[x + 1][y + 1] && board[x][y + 2] == board[x + 2][y]) || // check backward diagonal
(board[x + line][y] == board[x + line][y + 1] && board[x + line][y] == board[x + line][y + 2]) || // check rows
(board[x][y + line] ==board[x + 1][y + line] && board[x][y + line] == board[x + 2][y + line])) // check columns
{
if (board[x][y] != '-')
{
puts("HERE");
return 2;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment