// this boolean function is inside the walker class. It returns if the particle stucks to tree or not. boolean checkstuck(){ for (int i=0;i=0;i--){ Walker temp=walkers.get(i); temp.move(); if (temp.checkstuck()){ tree.add(new PVector(temp.location.x,temp.location.y)); walkers.remove(i); } } showtree(); } void showtree(){ closestdot=tree.size(); PVector last=tree.get(tree.size()-1); stroke(155,255,255); strokeWeight(4); point(last.x,last.y); float olddistance=10000; closestdot=tree.size(); if (tree.size()>4){ for (int i=0;i