‘еємIgЌƒ9кИ:мСєddО Ј( @€ЯаРПпрАяЏ  я(№/№/я(я рŸ 0№/8џ0@џ0?џ/8№ 0я(р п?Gџ@PџOWџOXџOPџ?Hџ0@№/7я@Oџ_`џ`hџ_hџPXџ 0р(пP_џopџpxџowџ_gџ@O№/8я'п'р 7№pџ€џ‡џ`oџ?Gя/7р Я€0?№€ˆџ?Hя/8р`/пo?G№OX№@Hя0?р/аpOW№?Hр/8п 7яOPя?Gр/7п(Я РP0@яPX№@Oя0@п 0аO а@H№/Я@'а 0п0@р@P№0?п'Я_OP№@Hр(а 7п/7а'Р Пџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ^^^^^^^^^^џџџџџџџџџџџџџџџџџџџџ^^^^^^^^^^^^^^џџџџџџџџџџџџџџџџ^^TeeBBBBeTT^^^^^^џџџџџџџџџџџџџ^eBDJ33333JJDBeZ^^^^џџџџџџџџџџџTD33==#####==3JDBT^^^^џџџџџџџџџeJ=###=3DeZ^^TџџџџџџџB3# #=3JBZ^^Tџџџџџџ3#  #=JBT^^џџџџџJ# Sll #=JBZ^Tџџџџ# %,68??86,/@A*< ##џџџџ45('.6787-9%:;*<=#џџџџџ$+&,--.,/01)2 3џџџџџџ $%&&'%($!)* ##џџџџџџџ  !"#џџџџџџџџџ  џџџџџџџџџџџ  џџџџџџџџџџџџџ џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџРџџџќџј№?рРР€€€€РРр№?јќџџџџРџd­]c’нт@ЄИєobject0Ўџџџџœџџџџџџџ И[џџџџЈcount = 0 re=-25600000 im=-43840000 for (y=0; y70 event_perform(ev_create,0) for (y=0; y-1000000 && ti[x,y]> -1000000&& tr[x,y]<1000000 && ti[x,y]<1000000)//avoid arithmetic overflow { cr=x*12500+re zr=tr[x,y]*tr[x,y]-ti[x,y]*ti[x,y]+ cr zi=2*tr[x,y]*ti[x,y]+ci ti[x,y] =zi/8100 tr[x,y] =zr/8100 brush_color=tr[x,y]*tr[x,y]+ti[x,y]*ti[x,y] draw_pixel(x,y) } } } 0000000џџџџџџџџџџџџЄroom0єДДРРР show_info()џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€р џџџџџџџџџџџџ€р џџџџџџџџџџџџ€р џџџџџџџџџџџџ€р џџџџџџџџџџџџ€р џџџџџџџџџџџџ€р џџџџџџџџџџџџ€р џџџџџџџџџџџџ€р џџџџџџџџџџџџ Ё†Ё†€–˜ЎџџсФ{\rtf1\ansi\deff0\deftab720{\fonttbl{\f0\fswiss MS Sans Serif;}{\f1\froman\fcharset2 Symbol;}{\f2\fswiss\fcharset1 Arial;}{\f3\fswiss\fcharset1 Arial;}{\f4\froman Times New Roman;}{\f5\fmodern\fcharset1 Courier New;}{\f6\fmodern\fcharset1 Courier New;}} {\colortbl\red0\green0\blue0;\red0\green0\blue128;\red0\green0\blue255;} \deflang1033\pard\plain\f3\fs28\cf0\b Fractals \par \plain\f3\fs24\cf0\b Tony Forster October 05\plain\f3\fs24\cf0 \par \plain\f3\fs16\cf0 May be copied with acknowledgement \par \plain\f3\fs24\cf0 \par Press escape to start \par May take some time for screen to update on a slow computer \par Press escape to quit (may take some time) \par \par Got a slow computer? Reduce the room size. Got a fast computer? Increase it. \par \par \plain\lang3081\f4\fs24 Although Mandelbrot invented the word fractal, many of the fractal objects had been previously described by other mathematicians. However, they had been regarded as isolated curiosities with unnatural and non-intuitive properties. Mandelbrot brought these objects together for the first time and highlighted their common properties. \par \par \plain\lang3081\f4\fs24\cf0 He also emphasised the use of fractals as realistic and useful models of many natural phenomena, including the shape of coastlines and river basins; the structure of plants, blood vessels and lungs; the clustering of galaxies; Brownian motion; and stock market prices. Far from being unnatural, Mandelbrot held the view that fractals were, in many ways, more intuitive and natural than the artificially smooth objects of traditional Euclidean geometry. \par \par As he says in the Introduction to The Fractal Geometry of Nature: \par \par \pard\li360\plain\lang3081\f4\fs24\i Clouds are not spheres, mountains are not cones, coastlines are not circles, and bark is not smooth, nor does lightning travel in a straight line.\plain\lang3081\f4\fs24 \par \pard\plain\f3\fs24\cf0 \par The Mandelbrot set is defined by the iterative recalculation of: \par \par \tab z = z\'b2 + c \par \par where z and c are complex numbers, made up of a \plain\f3\fs24\cf0\i real\plain\f3\fs24\cf0 part x and an \plain\f3\fs24\cf0\i imaginary\plain\f3\fs24\cf0 part iy where i is the square root of -1. Confused already? You can't take the square root of a negative number? Just note that squaring iy turns it from imaginary back to real, (iy)\'b2 = -y\'b2. \par \par Breaking z and c up into their real and imaginary components, zr, zi, cr & ci gives: \par \par \tab zr + zi = (zr + zi)\'b2 + cr +ci \par \tab zr + zi = zr\'b2 + 2zr*zi - zi\'b2 +cr +ci \par \par which can be split into 2 equations, the real and the imaginary: \par \par \tab zr = zr\'b2 - zi\'b2 +cr (real) \par \tab zi = 2zr*zi + ci\tab (imaginary) \par \par Now compare this with the program, these equations are there, right in the middle of the draw event: \par \par \plain\f6\fs20\cf0 \tab zr=tr[\plain\f6\fs20\cf2 x\plain\f6\fs20\cf0 ,\plain\f6\fs20\cf2 y\plain\f6\fs20\cf0 ]*tr[\plain\f6\fs20\cf2 x\plain\f6\fs20\cf0 ,\plain\f6\fs20\cf2 y\plain\f6\fs20\cf0 ]-ti[\plain\f6\fs20\cf2 x\plain\f6\fs20\cf0 ,\plain\f6\fs20\cf2 y\plain\f6\fs20\cf0 ]*ti[\plain\f6\fs20\cf2 x\plain\f6\fs20\cf0 ,\plain\f6\fs20\cf2 y\plain\f6\fs20\cf0 ]+ cr\plain\f6\fs20\cf1 \par \plain\f6\fs20\cf0 \tab zi=2*tr[\plain\f6\fs20\cf2 x\plain\f6\fs20\cf0 ,\plain\f6\fs20\cf2 y\plain\f6\fs20\cf0 ]*ti[\plain\f6\fs20\cf2 x\plain\f6\fs20\cf0 ,\plain\f6\fs20\cf2 y\plain\f6\fs20\cf0 ]+ci\plain\f6\fs20\cf1 \par \plain\f3\fs24\cf0 \par Now lets put the program together, line by line. \par We are doing the above calculation for every pixel in the room. The arrays \plain\f6\fs20\cf0 tr[\plain\f6\fs20\cf2 x\plain\f6\fs20\cf0 ,\plain\f6\fs20\cf2 y\plain\f6\fs20\cf0 ]\plain\f3\fs24\cf0 and \plain\f6\fs20\cf0 ti[\plain\f6\fs20\cf2 x\plain\f6\fs20\cf0 ,\plain\f6\fs20\cf2 y\plain\f6\fs20\cf0 ]\plain\f3\fs24\cf0 are storage for zr and zi for every point in the room. They are set to zero in the create event: \par \par \plain\f6\fs20\cf0\b for\plain\f6\fs20\cf0 (\plain\f6\fs20\cf2 y\plain\f6\fs20\cf0 =0; \plain\f6\fs20\cf2 y\plain\f6\fs20\cf0 <\plain\f6\fs20\cf2 room_height\plain\f6\fs20\cf0 ; \plain\f6\fs20\cf2 y\plain\f6\fs20\cf0 +=1)\plain\f6\fs20\cf2 \par \plain\f6\fs20\cf0\b \{\plain\f6\fs20\cf2 \par \plain\f6\fs20\cf0 \plain\f6\fs20\cf0\b for\plain\f6\fs20\cf0 (\plain\f6\fs20\cf2 x\plain\f6\fs20\cf0 =0; \plain\f6\fs20\cf2 x\plain\f6\fs20\cf0 <\plain\f6\fs20\cf2 room_width\plain\f6\fs20\cf0 ; \plain\f6\fs20\cf2 x\plain\f6\fs20\cf0 +=1)\plain\f6\fs20\cf2 \par \plain\f6\fs20\cf0 \plain\f6\fs20\cf0\b \{\plain\f6\fs20\cf0 \plain\f6\fs20\cf2 \par \plain\f6\fs20\cf0 tr[\plain\f6\fs20\cf2 x\plain\f6\fs20\cf0 ,\plain\f6\fs20\cf2 y\plain\f6\fs20\cf0 ]=0\plain\f6\fs20\cf2 \par \plain\f6\fs20\cf0 ti[\plain\f6\fs20\cf2 x\plain\f6\fs20\cf0 ,\plain\f6\fs20\cf2 y\plain\f6\fs20\cf0 ]=0\plain\f6\fs20\cf2 \par \plain\f6\fs20\cf0 \plain\f6\fs20\cf0\b \}\plain\f6\fs20\cf2 \par \plain\f6\fs20\cf0\b \}\plain\f6\fs20\cf2 \par \plain\f3\fs24\cf0 \par Every point in the room has a different c value, the imaginary ci for the vertical y axis and the real cr for the horixontal x axis. There are a few constants, re and im for offset and 12500 for scale thrown in so we see the pretty part of the pattern in the room. \par \par \plain\f6\fs20\cf0 \tab ci=\plain\f6\fs20\cf2 y\plain\f6\fs20\cf0 *12500+im \par \tab cr=\plain\f6\fs20\cf2 x\plain\f6\fs20\cf0 *12500+re\plain\f3\fs24\cf0 \par \par Finally we calculate the colour based on the magnitude of z (its real & its imaginary components) zr\'b2 +zi\'b2 and plot the pattern: \par \par \plain\f6\fs20\cf2 \tab brush_color\plain\f6\fs20\cf0 =tr[\plain\f6\fs20\cf2 x\plain\f6\fs20\cf0 ,\plain\f6\fs20\cf2 y\plain\f6\fs20\cf0 ]*tr[\plain\f6\fs20\cf2 x\plain\f6\fs20\cf0 ,\plain\f6\fs20\cf2 y\plain\f6\fs20\cf0 ]+ti[\plain\f6\fs20\cf2 x\plain\f6\fs20\cf0 ,\plain\f6\fs20\cf2 y\plain\f6\fs20\cf0 ]*ti[\plain\f6\fs20\cf2 x\plain\f6\fs20\cf0 ,\plain\f6\fs20\cf2 y\plain\f6\fs20\cf0 ] \par \tab \plain\f6\fs20\cf1 draw_pixel\plain\f6\fs20\cf0 (\plain\f6\fs20\cf2 x\plain\f6\fs20\cf0 ,\plain\f6\fs20\cf2 y\plain\f6\fs20\cf0 ) \par \plain\f3\fs24\cf0 \par \par } єєSpritesSounds BackgroundsPathsScripts Data Files Time LinesObjectsobject0Roomsroom0 Game Information Game Options