In Tic Tac Toe, Program works for horizontal, and vertical, but it does not work for diagonal.
I think that private bool checkWin
part is wrong.
private bool checkWin()
{
for (int row=0; row<3; row++)
{
if (values[row,0] != ' ' && values[row,0]==values[row,1]&&values[row,0]==values[row, 2])
{
lockButton(false);
return true;
}
}
for (int col = 0; col < 3; col++)
{
if (values[0, col] != ' ' && values[0, col] == values[1, col] && values[0, col] == values[2, col])
{
lockButton(false);//asdfasdfsdafadsfasdfasdfasdf
return true;
}
}
return false;
}