This is a simple exercise to implement the boundary following production systems in the Pacman game from UC Berkeley. The goal of the Pacman game is simple: control the Pacman to eat all the foods in the map, as shown below.
- NaiveAgent: The agent goes west until it cannot.
- PSAgent: The agent moves according to a pre-defined production system.
- ECAgent: The agent moves according to a perceptron trained using the error-correction method.
- SMAgent: The agent is a state machine with impaired sensors and moves according to a production system based on previous and current senses, as well as the previous move.
The ECAgent's action is determined by a single layer perceptron trained on the four training sets named north.csv, east.csv, south.csv, and west.csv. Each file stores the environment states when moving north, east, south, and west. Each vector in the training set is in the form of
The SMAgent is sensory-impaired and can only received only 4 sensor inputs from the 4 directions: north, east, south, west. The agent receives sensor values from the getPacmanImpairedSensor function. The sensory input SMAgent can remember the previous action prevAction and the previous sensory input prevSense. The agent moves according to a production system based on previous and current senses, as well as the previous move.
Run python pacman.py --layout testMap --pacman NaiveAgent to how the NaiveAgent acts. Note that the --layout parameter specifies the map, and the --pacman parameter specifies the agent.
