First, we define a class hierarchy with two classes 'robot' and 'particle' and one super-class 'agent'. The whole set of behaviors which is identical for 'agent' and 'particle' is delegated to objects of class 'agent'. For our simulations it is sufficient to generate only one instance of classes 'robot' and 'particle'.
Second, we implement the evaluation of the particle filter's inference result. We compute the expected distance of the robot's terminal position to the positions of the particles comprising the posterior distribution.