Pizza Time! - Autonomous Agents Simulation (2017)

Every Friday at 6pm, my department shares a bunch of pizza pies for dinner. As soon as pizzas arrive on our floor, all students start running towards the pizzas. Every student is allowed to get only one slice at a time so students try to eat their slice as soon as possible so they can get another slice before all pizzas are gone.

I found this phenomenon pretty funny so I implemented a crowd simulation of the students using Processing. The code is found here on my GitHub.

Each autonomous agent moves according to these following rules that I defined after observing students' behaviors, and the set of rules create a crowd behavior.

- Agents are attracted to the closest pizza.
- Agents repel each other so they don’t collide.
- Agents move away from the pizza after they eat.
- Agents get hungry again after a certain amount of time from eating.
- Agents stay still near the pizza while they're eating.
- Agents bounce off when they hit the walls.
- The color of texts show how hungry/full students are (darker color means more full).

To use the app,

- Users click the left mouse button to create a student.
- Users click the right mouse button to create a pizza.

Below is a video documentation of the app being used.