Qbasicnews.com
matrix fractal - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: QbasicNews.Com (http://qbasicnews.com/newforum/forum-3.html)
+--- Forum: Challenges (http://qbasicnews.com/newforum/forum-10.html)
+--- Thread: matrix fractal (/thread-4641.html)



matrix fractal - Diroga - 09-08-2004

ok heres the deal: make a fractal pattern but insted of color use matrix code(ascii in green scale) to make it more challenging have it zoom. yeah crazy....


matrix fractal - TheBigBasicQ - 09-08-2004

i think theres a screensave in KDE which is similar to that...


matrix fractal - Neo - 09-08-2004

It's also in the Fractal program that comes with Debian... Smile


matrix fractal - Diroga - 09-09-2004

oh well then...
i have never seen it. is there a non linux way of see it?


matrix fractal - TheBigBasicQ - 09-10-2004

yes, get its source code and compile it =P.


matrix fractal - DefHo - 09-15-2004

Like this? :lol:

Code:
DECLARE SUB ffix (Mode%)
SCREEN 12

DEFINT A-Z


DIM screen$(80, 30)
FOR x = 1 TO 80
  FOR y = 1 TO 30
    screen$(x, y) = CHR$(INT(RND * 200 + 48))
    'Uncomment to see the fractal better.
    'screen$(x, y) = CHR$(219)
  NEXT
NEXT



ffix 0

FOR i = 0 TO 15
  OUT 968, i
  OUT 969, 0
  OUT 969, i * 4
  OUT 969, 0
NEXT


DO

a! = a! + .01
cr! = SIN(a!) * .5
ci! = SIN(a! * 1.1 + 2)

yv = yv - 1
IF yv < 0 THEN yv = yv + 30

FOR y = 1 TO 30
  FOR x = 1 TO 80
    rx = x - 40
    ry = y - 15
    orn! = (rx / 40)
    oin! = (ry / 15)
    FOR i = 0 TO 14
      rn! = orn! * orn! - oin! * oin! + cr!
      in! = 2 * orn! * oin! + ci!
      size& = rn! * rn! + in! * in!
      IF size& > 5 THEN EXIT FOR
      orn! = rn!
      oin! = in!
    NEXT
    

    COLOR i
    LOCATE y, x
    PRINT screen$(x, (y + yv) MOD 30);
  NEXT
NEXT

LOOP UNTIL LEN(INKEY$)


ffix -1




END


SUB ffix (Mode%) STATIC
'FFix by Dav,Plasma and v1ctor
IF Mode% = 0 THEN
    DIM isr(0 TO 5) AS LONG
    isr(0) = &H53EC8B55: isr(1) = &H83025E8B
    isr(2) = &H8E0602EB: isr(3) = &HC7260446
    isr(4) = &H79B9007: isr(5) = &HCF9B5D5B
    DEF SEG = 0
    OldISR1 = PEEK(&HF4)
    OldISR2 = PEEK(&HF5)
    OldISR3 = PEEK(&HF6)
    OldISR4 = PEEK(&HF7)
    POKE &HF4, VARPTR(isr(0)) AND 255
    POKE &HF5, (CLNG(VARPTR(isr(0))) AND &HFF00&) \ 256
    POKE &HF6, VARSEG(isr(0)) AND 255
    POKE &HF7, (CLNG(VARSEG(isr(0))) AND &HFF00&) \ 256

ELSE

DEF SEG = 0
POKE &HF4, OldISR1
POKE &HF5, OldISR2
POKE &HF6, OldISR3
POKE &HF7, OldISR4


END IF

END SUB

Well. It doesn't zoom, but oh well. 8)