11_seating_system.rb
# Returns any neighbours that can now known to be locked empty.
Returns any neighbours that can now known to be locked empty.
Returns any neighbours that can now known to be locked empty .
def lock_occupied(seats)
    return [] if @locked_known
    @locked_known = OCCUPIED
    @neighs.filter_map { |npos|
      neigh = seats[npos]
      next if neigh.locked_known
      old_min = neigh.min_occupied_neigh
      neigh.known_occupied_neigh += 1
      neigh.unknown_neigh -= 1
      neigh if old_min == 0
    }
  end
def lock_occupied ( seats ) return [ ] if @locked_known @locked_known = OCCUPIED @neighs . filter_map { | npos | neigh = seats [ npos ] next if neigh . locked_known old_min = neigh . min_occupied_neigh neigh . known_occupied_neigh += 1 neigh . unknown_neigh -= 1 neigh if old_min == 0 } end
Returns any neighbours that can now known to be locked empty.
Returns any neighbours that can now known to be locked empty .
seats
<not_specific>