Vacuum Cleaner World Simulation
Greedy Algorithm Agent Simulation
Solo Developer · 2024 · Personal Project

A Python simulation of basic AI agent behavior: a vacuum cleaner navigates a customizable grid of rooms (4x4 by default) and uses a greedy algorithm to find and clean the nearest dirty room, visualised in real time with Matplotlib.
How the algorithm works
Starting at (0,0), the agent scans for dirty rooms, calculates the Manhattan distance to each (|x1-x2| + |y1-y2|), moves one step at a time toward the nearest one, cleans on arrival, and repeats until the grid is clean. It's a deliberately simple demonstration: the agent makes locally optimal choices at each step without any guarantee of global efficiency, which is the whole point of a greedy algorithm.
Features
Customizable grid size, 4x4 by default
Randomized room states (clean or dirty) on each run
Real-time visualization via Matplotlib
Action log printed to the terminal as the agent moves