Friday 5 November 2010

Four Lines of Redcode

Sierpinski triangle

The Sierpinski triangle or gasket is a fractal named after the Polish mathematician Waclaw Sierpinski. Surprisingly the fractal can be generated with just 4 lines of Redcode:

        width  equ 126
        trail  equ (sum-CORESIZE%width)
        start  equ (trail-width+1)

sum     mov    #3,    @3
ptr     mov.b  trail, sum
        add.b  {ptr,  sum
        djn    sum,   #start

The magic incantation for pMARS is pmars -v 132. Alternatively set the width to 128 to view using CoreWin :-)

No comments: