Example #1
0
        public override IEnumerable <Square> GetAvailableMoves(Board board)
        {
            var currentSquare = board.FindPiece(this);

            var minusOneToOne = new List <int>(new[] { -1, 0, 1 });

            var moves = new List <MoveVector>(new[]
            {
                new MoveVector(-1, -1),
                new MoveVector(-1, 0),
                new MoveVector(-1, 1),
                new MoveVector(0, -1),
                new MoveVector(0, 1),
                new MoveVector(1, -1),
                new MoveVector(1, 0),
                new MoveVector(1, 1),
            });

            return(MoveVector.FindAvailableMovesFromVectors(moves, board, currentSquare));
        }
Example #2
0
        public override IEnumerable <Square> GetAvailableMoves(Board board)
        {
            var currentSquare = board.FindPiece(this);

            var oneMinusOne = new List <int>(new[] { 1, -1 });
            var twoMinusTwo = new List <int>(new[] { 2, -2 });

            // Make set of possible jumps: (+-2, +- 1) u (+-1, +-2)
            var jumps = new List <MoveVector>(new []
            {
                new MoveVector(-2, -1),
                new MoveVector(-2, 1),
                new MoveVector(2, -1),
                new MoveVector(2, 1),
                new MoveVector(-1, -2),
                new MoveVector(-1, 2),
                new MoveVector(1, -2),
                new MoveVector(1, 2),
            });

            return(MoveVector.FindAvailableMovesFromVectors(jumps, board, currentSquare));
        }