So, what's the story? A robot is spawned on some territory. No idea where. But it has a map! But also very crippled observation means, being only able to scan the distance to the closest wall along a small set of directions (right, left, up, down). So it is using Particle Filter to guess where is the most probable place it can actually be.
Modus Operandi: Robot wanders around. Click Start Probing to generate particles. The more particles on an area, the most likely the robot it thinks it's actually there. The robot is probing its environment every X step, each step being a one pixel move. You can modify the number of steps and also the total number of particles.
To know more about Particle Filter, go see the Stanford ai-class.com course taught by Sebastian Thrun and Peter Norvig. Thanks so much for a great course!
For more info, the code is document: particle_filter.js
Developped on Firefox, quickly tested on Chrome (much faster!).