Based on https://en.wikipedia.org/wiki/Particle_filter
Snake tracking on a 300x300 space using a bayesian particle filter.
The steps are as follows :
- Initialize the first n particles randomly
- Make them evolve the same way the snake would
- Assign a weight to them based on a observation (high weight if particle is at same position than snake, low otherwise)
- Sample them by recreating the particles with the lowest weights around the ones with the heighest weights
- Repeat from 2.
V1 is a simple version with the whole body being tracked (particles have weights, pos x, pos y)
V2 is a bit more complex, only the head is tracked (particles have current weights, pos x, pos y, head orientation, previous weight)
Can be seen in action here https://youtu.be/2oWaSpVfu4s