Author Topic: Short intro challenge 20 line fractal  (Read 4603 times)

0 Members and 1 Guest are viewing this topic.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17426
  • Karma: 499
  • evil/good
    • View Profile
    • My Homepage
Short intro challenge 20 line fractal
« on: June 12, 2006 »
Taking the Keftales and the Axial on a bit, also I've seen the Xor texture used in this comp, I decided to see if I could squeeze a proper fractal into 20 lines, I managed to squash the serpinski gasket down to 18 lines, could get it to 17 lines if I lost the windowed mode.

Code: [Select]
#define PTC_win
 #Include Once "tinyptc.bi"
 If( ptc_open( "DBF 18 LINE SERPINSKI GASKET FRACTAL BY SHOCKWAVE", 800, 600 ) = 1 ) Then dim shared buffer(800*600) as integer,points(1 to 8) as integer => { 400,5 , 5,595 , 795,595 , 400 , 5}
 do     
    for n=0 to 250
        buffer((points(7)+(points(8)*800))) = rgb(n shr 2 ,n , n shr 1)
        r=int(rnd*3)+1
        if r=1 then
             points(7) = (points(7) + points(1))  shr 1
             points(8) = (points(8) + points(2))  shr 1
        elseif r=2 then points(7) = (points(7) + points(3)) shr 1
            points(8) = (points(8) + points(4)) shr 1
        elseif r=3 then points(7) = (points(7) + points(5)) shr 1
            points(8) = (points(8) + points(6)) shr 1
        end if
    next
 ptc_update@buffer(0)
 loop until inkey$<>""
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17426
  • Karma: 499
  • evil/good
    • View Profile
    • My Homepage
Re: Short intro challenge 20 line fractal
« Reply #1 on: June 12, 2006 »
And here it is again, I have squashed this further, doing away with 5 lines to enable me to add some nice colours and rotate it in a nice way.
It's sort of a fake textured poly thing now :)


Still in 18 lines!!

Code: [Select]
#define ptc_win
 #define dbfcls redim buffer(800*600)
 #Include Once "tinyptc.bi"
 If( ptc_open( "DBF 18 LINE ROTATING SERPINSKI GASKET FRACTAL BY SHOCKWAVE", 800, 600 ) = 1 ) Then dim shared points(8) as integer
  do 
    dbfcls     
    for a=1 to 6
        if a mod 2=0 then points(a) = 299*sin((a*120)+timer *2.5)+300 else if a mod 2 <>0 then points(a) = 399*cos((a*120)+timer *1.5)+400 end if       
        if a= 2 then points(7)=points(1) else if a=3 then points(8)=points(2) end if
    next               
    for n=0 to 25000
        buffer((points(7)+(points(8)*800))) = rgb(points(7) shr 2,points(8) shr 3+points(7) shr 3,points(8) shr 2)
        r=int(rnd*3)+1       
             points(7) = (points(7) + points(r*2-1))  shr 1
             points(8) = (points(8) + points(r*2))  shr 1       
    next
ptc_update@buffer(0)
loop until inkey$<>""
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Tetra

  • DBF Aficionado
  • ******
  • Posts: 2532
  • Karma: 83
  • Pirate Monkey!
    • View Profile
Re: Short intro challenge 20 line fractal
« Reply #2 on: June 12, 2006 »
Good one  :)
if only you could subdivide polys to fill them in ;)
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Short intro challenge 20 line fractal
« Reply #3 on: June 13, 2006 »
Good one  :)
if only you could subdivide polys to fill them in ;)

Or change colors like a plasma effect... But still very smart for 18 lines of code :)
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17426
  • Karma: 499
  • evil/good
    • View Profile
    • My Homepage
Re: Short intro challenge 20 line fractal
« Reply #4 on: June 13, 2006 »
Thanks guys :)
Shockwave ^ Codigos
Challenge Trophies Won: