https://www.khanacademy.org/computer-programming/the-life-story-of-leafers-the-tree-game/6446266083704832
The code on the page the link goes to pretty much explains everything about it.
The code on the page the link goes to pretty much explains everything about it.