This is a typical pen tree project. Press the green flag to play/replay the animation. Enter turbo mode to speed up the animation. You can press the 'space' key at any point (either after a run has finished or while the animation's running) to activate "rainbow mode".
This project doesn't use clones at all! So the only thing stopping me from raising the number of branches drawn is the screen size. There simply isn't enough space to fit a larger tree. Explanation: This project uses a breadth-first algorithm to draw the tree. Two lists are used to keep track of the nodes of the tree. The first is used to store the positions of the nodes added in the previous iteration of the loop, and the second is used to store the points that are being drawn in the current iteration of the loop. At the end of each iteration of the loop, the first list is emptied, and the contents of the second list is moved to the first list. In each iteration of the loop, two new nodes are drawn for each item in the first list, so the number of nodes doubles each time. Inspiration: I was playing around with the "turtle demo" feature of IDLE, the IDE that CPython is bundled with. I looked at the "tree" demo and decided to make this project. Partly to see if it's possible to achieve the same effect in Scratch, and partly to practice my algorithm skills. #animation #pentree #algorithm