Here's another quick code on a fractal tip!
' Little Mandlebrot using tinyptc by Shockwave ^ DBF
' Fuck I must be bored tonight....
'
' For those learning fractals, the colour of the point is determined by how many
' iterations of z=z^2 +c it takes to determine if a point is a part of the set or
' if it bails out before it can be determined (try playing with the iterations variable).
' Meh! Last time I coded one of these it was in Pascal in college a long time ago.
'
'-------------------------------------------------------------------------------
#DEFINE PTC_WIN
#Include Once "tinyptc.bi"
If( ptc_open( "LITTLE MANDELBROT BY SHOCKWAVE^DBF", 640, 480 ) = 0 ) Then End
dim shared buffer(640*480) as integer
dim shared as double XADD,XPX,YADD,YPY,AAAA,BBBB,FLOOP,AAA,BBB
option explicit
dim shared MINIMUM_X,MAXIMUM_X,TWAT,BOLLOCKS,PASS,ITERATIONS,y,x as integer
dim shared COLOUR_MULT as double
MINIMUM_X = 0
MAXIMUM_X = 640
TWAT = 0
BOLLOCKS = 479
PASS=6
ITERATIONS=50
COLOUR_MULT = (500/ITERATIONS)
do
XADD= (4/(MAXIMUM_X - MINIMUM_X))
XPX=-2.5
YADD= (4/(BOLLOCKS - TWAT))
YPY=-2
for y = TWAT to BOLLOCKS
XPX=-2.5
for x = MINIMUM_X to MAXIMUM_X
AAA=XPX
BBB=YPY
FLOOP=0
do
FLOOP=FLOOP+1
AAAA=AAA*AAA-BBB*BBB+XPX
BBBB=2*AAA*BBB+YPY
AAA=AAAA
BBB=BBBB
loop until ((FLOOP>ITERATIONS) or ((AAA*AAA)+(BBB*BBB)>PASS))
if FLOOP>=ITERATIONS then
FLOOP=0
else
FLOOP=FLOOP*COLOUR_MULT
end if
buffer((y*640)+x)=rgb(0,FLOOP,FLOOP)
XPX = XPX + XADD
next x
YPY = YPY + YADD
next y
ptc_update@buffer(0)
loop until inkey$<>""