Exemplo n.º 1
0
        protected virtual bool WouldBeSuicide(Move move, Player player)
        {
            ChessUtilities.ThrowIfNull(move, nameof(move));
            var copy = new AtomicChessGame(Board, player);

            copy.ApplyMove(move, true);
            bool ownKingIsGone = copy.KingIsGone(player);

            if (ownKingIsGone)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        protected virtual bool WouldBeSuicideOrInvalidSelfMoveInCheck(Move move, Player player)
        {
            ChessUtilities.ThrowIfNull(move, nameof(move));
            var copy = new AtomicChessGame(Board, player);

            copy.ApplyMove(move, true);
            bool ownKingIsGone   = copy.KingIsGone(player);
            bool otherKingIsGone = copy.KingIsGone(ChessUtilities.GetOpponentOf(player));

            if (ownKingIsGone)
            {
                return(true);
            }
            else if (otherKingIsGone)
            {
                return(false);
            }
            else
            {
                return(copy.IsInCheck(player));
            }
        }
Exemplo n.º 3
0
 protected virtual bool WouldBeSuicideOrInvalidSelfMoveInCheck(Move move, Player player)
 {
     ChessUtilities.ThrowIfNull(move, "move");
     AtomicChessGame copy = new AtomicChessGame(Board, player);
     copy.ApplyMove(move, true);
     bool ownKingIsGone = copy.KingIsGone(player);
     bool otherKingIsGone = copy.KingIsGone(ChessUtilities.GetOpponentOf(player));
     if (ownKingIsGone)
     {
         return true;
     }
     else if (otherKingIsGone)
     {
         return false;
     }
     else
     {
         return copy.IsInCheck(player);
     }
 }
Exemplo n.º 4
0
 protected virtual bool WouldBeSuicide(Move move, Player player)
 {
     ChessUtilities.ThrowIfNull(move, "move");
     AtomicChessGame copy = new AtomicChessGame(Board, player);
     copy.ApplyMove(move, true);
     bool ownKingIsGone = copy.KingIsGone(player);
     if (ownKingIsGone)
     {
         return true;
     }
     else
     {
         return false;
     }
 }