Converting coding challenge 'Self-avoiding walk backtracing' from p5.js to Processing (Java)

Hi @GoToLoop ,
Thanks for the reply!
I have read the p5js version, but I can not figure out to convert it to processing code. I definately make some mistakes, but I can not figure them out. I wonder if someone can help to change it to processing java.