Пример #1
0
        /// <summary>
        ///   Make the specified move. For internal use only.
        /// </summary>
        /// <param name="moveName"> The move name. </param>
        /// <param name="piece"> The piece to move. </param>
        /// <param name="square"> The square to move to. </param>
        private static void MakeAMoveInternal(Move.MoveNames moveName, Piece piece, Square square)
        {
            MoveRedoList.Clear();
            Move move = piece.Move(moveName, square);

            move.EnemyStatus = move.Piece.Player.OpposingPlayer.Status;
            PlayerToPlay.Clock.Stop();
            MoveHistory.Last.TimeStamp = PlayerToPlay.Clock.TimeElapsed;
            if (PlayerToPlay.Intellegence == Player.PlayerIntellegenceNames.Computer)
            {
                WinBoard.SendMove(move);
                if (!PlayerToPlay.OpposingPlayer.CanMove)
                {
                    if (PlayerToPlay.OpposingPlayer.IsInCheckMate)
                    {
                        WinBoard.SendCheckMate();
                    }
                    else if (!PlayerToPlay.OpposingPlayer.IsInCheck)
                    {
                        WinBoard.SendCheckStaleMate();
                    }
                }
                else if (PlayerToPlay.OpposingPlayer.CanClaimThreeMoveRepetitionDraw == true)
                {
                    WinBoard.SendDrawByRepetition();
                }
                else if (PlayerToPlay.OpposingPlayer.CanClaimFiftyMoveDraw == true)
                {
                    WinBoard.SendDrawByFiftyMoveRule();
                }
                else if (PlayerToPlay.OpposingPlayer.CanClaimInsufficientMaterialDraw == true)
                {
                    WinBoard.SendDrawByInsufficientMaterial();
                }
            }

            BroadcastMovedName(move);
            CheckGameStatus();
            PlayerToPlay = PlayerToPlay.OpposingPlayer;
            PlayerToPlay.Clock.Start();
        }