def main(): clear() print('Initializing Test...') print('Creating Agents...') agent_types = ['miner', 'farmer', 'refiner', 'woodcutter', 'blacksmith'] agents = [Agent(random.choice(agent_types)) for i in range(100)] # 100 random angets agents = {agent.id: agent for agent in agents} # Debug Printing #print('Sample Agents...') #for agent in agents[:10]: # print(agent) input('Hit any key to continue...') print('Creating Market...') market = Market() market.agents = agents #This needs to be part of the api for Market class for i in range(50): #10 rounds of market simulation clear() market.simulate() report = market.market_report() print(report) report = market.agent_report() print(report) input('Hit any key to continue...')
def build_market(num_agents): """ This returns a market with the number of agents from the parameter right now, 100,000 agents is about the most it can handle. I was able to create a market with 500,000 but one round of market.simulate() took over a minute. 1,000,000 agents couldn't even be created.""" agent_types = ['miner', 'farmer', 'refiner', 'woodcutter', 'blacksmith'] agents = [Agent(random.choice(agent_types)) for i in range(num_agents)] # 100 random angets agents = {agent.id: agent for agent in agents} market = Market() market.agents = agents return market
def hist_test(rounds=1): agent_types = ['miner', 'farmer', 'refiner', 'woodcutter', 'blacksmith'] agents = [Agent(random.choice(agent_types)) for i in range(100)] # 100 random angets agents = {agent.id: agent for agent in agents} market = Market() market.agents = agents for i in range(rounds): #10 rounds of market simulation market.simulate() return market.history.export()