ScratchData LogoScratchData
Back to PutneyCat's profile

Menger Recursion

PUPutneyCat•Created February 4, 2024
Menger Recursion
113
87
1236 views
View on Scratch

Instructions

Green flag. (You can use turbo mode (shift-click green flag) to speed it up if you want.) How complicated do you think this is to code? Take a look inside. For better quality graphics, try it at https://turbowarp.org/961001769/fullscreen?hqpen (thanks to @papipupepappa for the link/suggestion). Thanks to @heldlaw for noticing that the original version of this was actually stamping each cube 20 times!

Description

Just a little illustration of the power of recursion, a method in which a function calls itself. If you look inside, you'll see the custom block using itself. It's not that easy to get your head around, but it's powerful. The Menger cube (aka sponge) is suitable for the illustration - the idea is that you divide a cube up into smaller cubes, get rid of some of them, and then apply the same process to each of the smaller cubes, then to each of the even smaller cubes and so on. There are plenty of excellent Menger projects on Scratch - raymarchers, ones that allow you to rotate the cube etc.

Project Details

Project ID961001769
CreatedFebruary 4, 2024
Last ModifiedFebruary 4, 2024
SharedFebruary 4, 2024
Visibilityvisible
CommentsAllowed