11_seating_system.rb
# Returns any neighbours that can now known to be locked occupied.
Returns any neighbours that can now known to be locked occupied.
Returns any neighbours that can now known to be locked occupied .
def lock_empty(seats, occupy_threshold)
    return [] if @locked_known
    @locked_known = EMPTY
    @neighs.filter_map { |npos|
      neigh = seats[npos]
      next if neigh.locked_known
      old_max = neigh.max_occupied_neigh
      neigh.unknown_neigh -= 1
      neigh if old_max == occupy_threshold
    }
  end
def lock_empty ( seats , occupy_threshold ) return [ ] if @locked_known @locked_known = EMPTY @neighs . filter_map { | npos | neigh = seats [ npos ] next if neigh . locked_known old_max = neigh . max_occupied_neigh neigh . unknown_neigh -= 1 neigh if old_max == occupy_threshold } end
Returns any neighbours that can now known to be locked occupied.
Returns any neighbours that can now known to be locked occupied .
seats
<not_specific>
occupy_threshold
<not_specific>