Autocrafting algorithms

How it's made (automatically) (in computer games with Minecraft-like recipe systems).