private void MakeMove(int x, int y) { // is this a valid move? if (_pieces[x, y] != null) { _app.GetSound("bonk").Play(); return; } int player = (movesElapsed++) % 2; // create the piece _pieces[x, y] = CreatePiece(player, x, y); bool victory = IsVictory(); bool draw = !victory && movesElapsed == 9; if (victory || draw) { _app.GetSound(victory ? "tivo" : "thumbsdown").Play(); System.Threading.Thread.Sleep(2000); TimeSpan sec1 = TimeSpan.FromSeconds(1); for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { View piece = _pieces[i, j]; if (piece != null) { Animation animation = new Animation(); if (victory) { animation.AddMove(piece.Location + new Size((i - 1) * 400, (j - 1) * 300), 0, sec1); } animation.AddFade(1, 0, sec1); piece.Animate(animation); _piecesView.Children.Remove(piece, sec1); _pieces[i, j] = null; } } } movesElapsed = 0; } }