예제 #1
0
        public IEnumerable <Move> GetMoves(Checkerboard checkerboard, Pawn pawn)
        {
            var movesUpperRight = checkerboard.FindMovesAlongDirection(pawn, new Position(1, 1));
            var movesUpperLeft  = checkerboard.FindMovesAlongDirection(pawn, new Position(1, -1));
            var movesLowerRight = checkerboard.FindMovesAlongDirection(pawn, new Position(-1, 1));
            var movesLowerLeft  = checkerboard.FindMovesAlongDirection(pawn, new Position(-1, -1));

            foreach (var move in movesUpperRight)
            {
                yield return(move);
            }

            foreach (var move in movesUpperLeft)
            {
                yield return(move);
            }

            foreach (var move in movesLowerRight)
            {
                yield return(move);
            }

            foreach (var move in movesLowerLeft)
            {
                yield return(move);
            }
        }