class Customer attr_accessor :position # 席番号 attr_accessor :want_toppings # 欲しいネタリスト def initialize(position, toppings) @position, @want_toppings = position, toppings end def eat(topping_name) index = @want_toppings.index(topping_name) unless index.nil? @want_toppings.delete_at(index) return true end false end end class ConveyorBeltSushiSystem SEAT_LENGTH = 20 attr_accessor :dishes attr_accessor :customers def initialize @dishes = Array.new(self.class::SEAT_LENGTH, nil) @customers = Array.new(self.class::SEAT_LENGTH, nil) end def go_round @customers.each do |customer| @dishes.each do |dish| customer.eat(dish) end end @dishes.each do |dish| dish.move end end end