private void InitializeGame() { for (int i = 0; i < 9; i++) { GameSquareItem g = appGrd1.Children[i] as GameSquareItem; g.MouseLeftButtonUp += (s, e) => SetNext(g); _squares[i] = g; } }
public void SetNext(GameSquareItem s) { if (s.IsFilled || _endOfMath) { return; } if (_next) { s.SetX(); } else { s.SetO(); } nextturn.Content = !_next ? "Player 1 Move" : "Player 3 Move"; nextturn.Foreground = Brushes.Indigo; CheckWin(); _next = !_next; }