So in particular, one thing that will work for this problem is if your states in the state space are a pair where on one hand you've got your position, the x,y coordinate, and on the other pair you've got some encoding of what dots are left like say, a boolean for each dot whether it's been eaten or not. 