Home - creechD/DealershipSimulation GitHub Wiki

Welcome to the DealershipSimulation wiki!

This wiki will serve as documentation for most of what is created in this project. The first part of this wiki will give a high level overview of the major programs used, then it will discuss the program governing the logic of all agents in the simulation. Pages will be created for each major class describing features that are currently implemented and design goals for what still needs to be added. A master TODO list will also be created for our reference.

About the Agents

Each agent in the simulation operates by switching between different "states". States can be thought of as the different mindsets each agent is thinking at the time, e.g. customer has a "shopping" state where the customer is looking at cars in the showroom, but has not been engaged by any salespeople. When certain conditions are met (currently a random number generator) the agent switches to a new state. Full descriptions of each state can be found on each agents' page.

dealershipSim.py

This is the program that runs the simulation. It defines all of the variables used by pygame to generate the window and most things in the window (text boxes and buttons). the primary function, MainLoop, serves as the game's looping engine. dlr.clock.tick(20) prevents the program from going faster than 20 frames per second. Within the loop, self.paused determines whether or not actions in the simulations are taken by the agents. The call to dlr.dealershipActions() tells the game to execute all actions in the dealership. Each agent has a timer built in to determine whether or not it can preform an action. Currently, both customers and salespeople move once every 2 seconds (built into their class), and the dealership can only spawn a new customer once ever 2 seconds too.

stateMachine.py

This is the brain of each agent. The main work horse is the function think. think tells each agent to preform any actions associated with the agent's current state, then it has the agent check to see if it is ready to change states, if the agent can change states, it executes exit_actions() from the old state and entry_actions() from the new state. Currently `entry_actions()' prints to the log the new state the agent is in.