Skip to content

Instantly share code, notes, and snippets.

Created January 3, 2013 14:46
Show Gist options
  • Save anonymous/4443964 to your computer and use it in GitHub Desktop.
Save anonymous/4443964 to your computer and use it in GitHub Desktop.
public class TicTacToe
{
static int[][] board;
public static void main(String[] args)
{
int player = 0;
boolean won = false;
for (int i=0; i<3; i++)
{
won = true;
player = board[i][0]
for (int j=0; j<3; j++)
{
if (board[i][j] != player)
{
won = false;
break;
}
}
}
for (int i=0; i<3; i++)
{
won = true;
player = board[0][i]
for (int j=0; j<3; j++)
{
if (board[j][i] != player)
{
won = false;
break;
}
}
}
// TODO: Diagonals (i=j and i=3-j)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment