Skip to content

Instantly share code, notes, and snippets.

@Orpheon
Forked from anonymous/TicTacToe
Created January 3, 2013 14:47
Show Gist options
  • Save Orpheon/4443966 to your computer and use it in GitHub Desktop.
Save Orpheon/4443966 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