... consumer’s demand to be a point in the demand curve in $generated_demand. Before we start with the producer, we populate the demand_supply array with the current market demand and supply. Then ... price_demand array with the average price of goods and the market demand. Finally, we loop through each consumer and get him to buy. We add in an extra loop to make sure all the demands are ... |consumer| consumer.demands = $generated_demand[t] end demand_supply << [t, Market.demand, Market.supply] $producers.each do |producer| producer.produce end price_demand << [t,...