for (int i = 0; i < x + 10; i++)
{
for (int j = 0; j < x + 10; j++)
{
if ( (list[i][j].Text == "x" && list[i + 1][j].Text == "x" && list[i + 2][j].Text == "x" && list[i + 3][j].Text == "x" && list[i + 4][j].Text == "x")
|| (list[i][j].Text == "x" && list[i][j + 1].Text == "x" && list[i][j + 2].Text == "x" && list[i][j + 3].Text == "x" && list[i][j + 4].Text == "x")
|| (list[i][j].Text == "x" && list[i + 1][j + 1].Text == "x" && list[i + 2][j + 2].Text == "x" && list[i + 3][j + 3].Text == "x" && list[i + 4][j + 4].Text == "x")
|| (list[i][j].Text == "x" && list[i + 1][j + 1].Text == "x" && list[i + 2][j + 2].Text == "x" && list[i + 3][j + 3].Text == "x" && list[i + 4][j + 4].Text == "x")
|| (list[i][j].Text == "x" && list[i + 1][j - 1].Text == "x" && list[i + 2][j - 2].Text == "x" && list[i + 3][j - 3].Text == "x" && list[i + 4][j - 4].Text == "x"))
{
timer1.Enabled = false;
Win winner = new Win();
winner.StartPosition = FormStartPosition.CenterScreen;
winner.Show();
rex = true;
winner.TxtBoxWin = "X WON!";
scoreX++;
scoreXtext = Convert.ToString(scoreX);
toolStripMenuItem4.Text = scoreXtext;
break;
}
else if ( (list[i][j].Text == "o" && list[i + 1][j].Text == "o" && list[i + 2][j].Text == "o" && list[i + 3][j].Text == "o" && list[i + 4][j].Text == "o")
|| (list[i][j].Text == "o" && list[i][j + 1].Text == "o" && list[i][j + 2].Text == "o" && list[i][j + 3].Text == "o" && list[i][j + 4].Text == "o")
|| (list[i][j].Text == "o" && list[i + 1][j + 1].Text == "o" && list[i + 2][j + 2].Text == "o" && list[i + 3][j + 3].Text == "o" && list[i + 4][j + 4].Text == "o")
|| (list[i][j].Text == "o" && list[i + 1][j - 1].Text == "o" && list[i + 2][j - 2].Text == "o" && list[i + 3][j - 3].Text == "o" && list[i + 4][j - 4].Text == "o") )
{
timer1.Enabled = false;
Win winner = new Win();
winner.StartPosition = FormStartPosition.CenterScreen;
winner.Show();
winner.TxtBoxWin = "O WON!";
scoreO++;
scoreOtext = Convert.ToString(scoreO);
toolStripMenuItem5.Text = scoreOtext;
rex = true;
break;
}
}
}