This was half made by accident.
I was trying to procedurally generate some patterns to use as textures, I made two loops, x and y and plotted if x and y = 1 and up popped a serpinski triangle!

' ACCIDENTAL SERPINSKI TRIANGLE!
' By Shockwave^DBF
'--------------------------------------------------------------------------
OPTION STATIC
OPTION EXPLICIT
'-------------------------------------------------------------------------
' Includes.
'-------------------------------------------------------------------------
#define PTC_WIN
#Include Once "tinyptc.bi"
'-------------------------------------------------------------------------
' Open Screen;
'-------------------------------------------------------------------------
If( ptc_open( "EHHH??!", 256, 256 ) = 0 ) Then
End -1
End If
Dim Shared As uInteger Buffer( 256 * 256 ):' Screen Buffer.
'-------------------------------------------------------------------------
'Please ditch the defs below, they are for the shit fps counter.
'Benchmark reading when nothing is happening is;
'
'-------------------------------------------------------------------------
declare sub millisecs()
DIM SHARED AS DOUBLE oldtime,newtime
dim shared ticks,t as integer
'-------------------------------------------------------------------------
' Main Loop;
'-------------------------------------------------------------------------
dim x,y,cc as integer
DO
for y=0 to 255
cc=Y*256
for x=0 to 255
if (x and y) = 1 then
buffer(cc+x) = &hffffff
end if
next
next
millisecs()
ptc_update@buffer(0)
ticks=ticks+1 :' <-- Ditch this (FPS Counter)
LOOP UNTIL INKEY$ = CHR$(27)
'-------------------------------------------------------------------------
' Shit FPS Counter, discard.
'-------------------------------------------------------------------------
SUB Millisecs()
dim as double t
t=timer
if t-oldtime >=1 then
newtime = ticks
ticks=0
oldtime=timer
print "FPS:"+str( (newtime) )
end if
end sub
The pseudo code is mighty simple if you want to convert this into any other language;
for y=0 to 255
for x=0 to 255
if (x and y) = 1 then plot x,y
next
next