Exemple #1
0
        private void BoardView_AskForFinish(object sender, Tuple <Square, Square> e)
        {
            //Game is finished
            if (GamePosition.Status != Position.GameResult.InProcess)
            {
                BoardView.CancelMove();
                MessageBox.Show("Error. Can't finish the move. Game is finished.");
            }

            int?Move = ConvertMove(e.Item1, e.Item2, GamePosition);

            if (Move is null)
            {
                BoardView.CancelMove();
            }
            else
            {
                if (PlayerToMove is HumanPlayer)
                {
                    PlayerToMove.MakeMove((int)Move);
                }
                else if (PlayerWaiting is HumanPlayer)
                {
                    PlayerWaiting.PreMoves.Push((int)Move);
                }
                else
                {
                    MessageBox.Show("Don't bother the comps! Let them play!");
                }
            }
        }