Welcome to Phrogram Sign in | Join | Help
in Search


Shortest program for Sierpinski triangle

Last post 09-30-2006, 12:40 PM by JonS. 1 replies.
Sort Posts: Previous Next
  •  09-30-2006, 10:19 AM 758

    Shortest program for Sierpinski triangle

    Attachment: Sierpinski.zip

    Today I found an old BASIC proram to draw the Sierpinski triangle:

    DEFINT X, Y

        FOR Y = 0 TO 255

            FOR X = 0 TO Y

                IF ( X AND ( Y - X ) ) = 0 THEN PSET ( X + 158 - .5*Y, Y + 30 )

            NEXT X

        NEXT Y

    END

    I translated it into Phrogram but it dosnt work.

    Phrogram cant compare two integers bit by bit, so I have to write a little helperfunction

    Now it works fine.

    Have fun

    Michael

  •  09-30-2006, 12:40 PM 763 in reply to 758

    Re: Shortest program for Sierpinski triangle

    Very cool, thanks again Michael!  This is our first ever example of bitwise AND logic implemented in Phrogram, woot!
View as RSS news feed in XML