Here, I've made a Baye filter (also known as a histogram filter) to keep track of a robot's current position in a 2D grid world. The robot is equipped with a noisy odometer and a noisy color sensor. Given a stream of actions and corresponding observations, the code updates the robot's belief state using the Bayes rule.
You can find the code here.