public Board() { int count = 0; for (int y = 0; y < 3; y++) for (int x = 0; x < 3; x++) { var s = new Square(); s.Tag = count; s.Square_Marked += Square_Played; s.Width = s.Height = this.Width / 3; squares[count++] = s; } Controls.AddRange(squares); }
void Square_Played(object sender, Square.Square_MarkedArgs e) { hits[(int)(sender as Square).Tag] = e.Player; Game.CheckStatus(this, e.Player); Game.GetNextPlayer(e.Player); }