Rosetta Examples development

Well, I did. But it took me more time. :mantelpiece_clock:

I’ve based mine on the Go version (although I barely know anything about that Google language): :woozy_face:
RosettaCode.org/wiki/Sierpinski_pentagon#Go

That version uses a fixed palette of 5 primary colors. :paintbrush:

In my sketch conversion I keep track of the current palette's index by returning it at the end of the recursive pentagon() function. :triangular_ruler:

In order to get a free color fill() I’m using beginDraw() + vertex() to draw each Sierpinski pentagon. :framed_picture:

The 1st sketch below is the Java Mode version w/ no special optimization: :coffee:

2nd sketch is the p5.js version, which caches all cos() & sin() calcs inside 2 Float32Array containers, similar to what I already did before to the Python Mode conversion: :bulb:

4 Likes