Method: Board#king_positions

Defined in:
lib/board.rb

#king_positionsObject

Search piece manifest for kings. Remove them from the list of positions returned from the Move module (so that players cannot take the “king” type piece)



143
144
145
146
147
148
149
150
151
# File 'lib/board.rb', line 143

def king_positions
  king_locations = []

  @piece_locations.each do |piece, details|
    king_locations << piece if details.fetch(:type) == :king
  end

  king_locations
end