Thursday, June 16, 2022

Sierpinski Triangle

Another quick BASIC conversion

Original Atari code:

10 DIM PT(3,2)
20 PT(1,0)=25:PT(1,1)=100*SQR(3)
30 PT(2,0)=133*2+25:PT(2,1)=PT(1,1)
40 PT(0,0)=(PT(1,0)+PT(2,0))/2:PT(0,1)=25
99 GRAPHICS 8+16:COLOR 1:PLOT PT(0,0),PT(0,1):OX=PT(0,0):OY=PT(0,1)
100 P=INT(RND(0)*3)
110 NX=(PT(P,0)+OX)/2:NY=(PT(P,1)+OY)/2
120 PLOT NX,NY:OX=NX:OY=NY:GOTO 100

Changes for the Color Computer:

0 POKE65495,0

30 PT(2,0)=230:PT(2,1)=PT(1,1)

99 PMODE4,1:SCREEN1,1:PCLS:PSET(PT(0,0),PT(0,1),1):OX=PT(0,0):OY=PT(0,1)
120 PSET(NX,NY,1):OX=NX:OY=NY:GOTO 100


 

No comments:

Post a Comment