Chess.Domain.MoveGetter.AxisMoves C# (CSharp) 메소드

AxisMoves() 공개 정적인 메소드

public static AxisMoves ( int row, int column ) : IEnumerable
row int
column int
리턴 IEnumerable
        public static IEnumerable<Move> AxisMoves(int row, int column)
        {
            var moves = new List<Move>();
            Action<int, int> addMove = (r, c) => moves.Add(new Move()
            {
                StartColumn = column,
                StartRow = row,
                EndColumn = c,
                EndRow = r
            });

            for (var r = 0; r < 8; r++)
                if (r != row)
                addMove(r, column);

            for (var c = 0; c < 8; c++)
                if (c != column)
                    addMove(row, c);

            return moves;
        }