예제 #1
0
        public override IEnumerable <Square> GetAvailableMoves(Board board)
        {
            var currentPos     = board.FindPiece(this);
            var availableMoves = lateralMove.GetLateralMoves(board, currentPos).ToList();

            return(availableMoves.Where(board.IsPositionValid));
        }
예제 #2
0
        public override IEnumerable <Square> GetAvailableMoves(Board board)
        {
            var currentPos     = board.FindPiece(this);
            var availableMoves = lateralMove.GetLateralMoves(board, currentPos).ToList();

            availableMoves.AddRange(diagonalMove.GetDiagonalMoves(board, currentPos));

            // Remove start square, duplicates and return
            availableMoves.RemoveAll(s => s == Square.At(4, 4));
            return(availableMoves.Where(board.IsPositionValid));
        }