예제 #1
0
 private IEnumerable <Move> getValidMovesFromPosition(ChessBoxPosition position)
 {
     return(from ChessBoxPosition newPosition in position.GetNeighbors()
            where desk.GetState(newPosition) == ChessBoxState.Empty
            select new Move(position, newPosition));
 }
예제 #2
0
 private IEnumerable <ChessBoxPosition> getNeighborsByPlayer(ChessBoxState player, ChessBoxPosition position, NeighborDirection direction = NeighborDirection.All)
 {
     return(from ChessBoxPosition neighborPosition in position.GetNeighbors(direction)
            where desk.GetState(neighborPosition) == player
            select neighborPosition);
 }