Open Menu
AllLocalCommunitiesAbout
lotide
AllLocalCommunitiesAbout
Login

Sierpinski triangle programs by 5 AI models

⁨18⁩ ⁨likes⁩

Submitted ⁨⁨3⁩ ⁨days⁩ ago⁩ by ⁨monica_b1998@lemmy.world⁩ to ⁨technology@lemmy.world⁩

https://slicker.me/javascript/sierpinski/ai_sierpinski.htm

source

Comments

Sort:hotnewtop
  • benni@lemmy.world ⁨2⁩ ⁨days⁩ ago

    It’s not pretty, but you can print one in a single line of python:

    print(*[“”.join("  " if i & j else “MM” for j in range(64)) for i in range(64)], sep=“\n”)

    source
    • monica_b1998@lemmy.world ⁨2⁩ ⁨days⁩ ago

      oh, wow! that’s so cool!

      source
  • msfroh@lemmy.ca ⁨3⁩ ⁨days⁩ ago

    I’m disappointed that none of them seem to have gone with the random convergence approach.

    Set the three corners of an equilateral triangle. Pick a random starting point on the canvas. Every iteration, pick a random corner from the triangle and your next point is the midpoint between the current point and that corner. While the original point is almost guaranteed not to be a point in Sierpinski’s triangle, each iteration cuts the distance between the new point and the nearest Sierpinski point in half.

    If you start plotting points starting with (say) the 50th one, every pixel is “close enough” to a Sierpinski point that you see the triangle materialize out of nothing. The whole thing could be programmed in about 20 lines of QBasic on DOS 30 years ago.

    source
    • monica_b1998@lemmy.world ⁨3⁩ ⁨days⁩ ago

      random convergence isn’t it the fourth one (NinjaTech)?

      source
      • msfroh@lemmy.ca ⁨3⁩ ⁨days⁩ ago

        Oh, maybe! I didn’t understand how it chose the points, but it does look like the random convergence approach.

        Nice, thanks!

        source
  • somethingsomethingidk@lemmy.world ⁨3⁩ ⁨days⁩ ago

    Here’s a cool video about it

    yewtu.be/watch?v=kbKtFN71Lfs

    source