Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Chaos Game
Author Message
Catalyst

Posted: Mon Mar 31, 2003 4:54 pm   Post subject: Chaos Game

an algorithm that generate fractals...

r and n change the look of it

takes a sec to load up, so be patient
 code: View.Set ("graphics:640;640,nobuttonbar") var ptx, pty : array 1 .. 120 of int var n : int := 4 var r : real := (6 / 10) function distance (x1, y1, x2, y2 : real) : real     result ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5 end distance proc drawRegPolygon (n0, a, x02, y02, C : int)     var x, y, x12, y12 : int     x12 := round (a * cosd ((360 / n0) * 0) + x02)     y12 := round (a * sind ((360 / n0) * 0) + y02)     for i : 1 .. n0         x := round (a * cosd ((360 / n0) * i) + x02)         y := round (a * sind ((360 / n0) * i) + y02)         ptx (i) := round (x)         pty (i) := round (y)         drawline (round (x), round (y), x12, y12, C)         x12 := round (x)         y12 := round (y)     end for     drawfillpolygon (ptx, pty, n0, C) end drawRegPolygon drawRegPolygon (n, maxx div 3, maxx div 2, maxy div 2, 7) var screen : array 1 .. maxx, 1 .. maxy of boolean for x : 1 .. maxx     for y : 1 .. maxy         if whatdotcolor (x, y) not= 0 then             screen (x, y) := true         else             screen (x, y) := false         end if     end for end for cls var x, y, dx, dy : real loop     x := Rand.Int (0, maxx)     y := Rand.Int (0, maxy)     exit when screen (round (x), round (y)) = true end loop drawfillbox (0, 0, maxx, maxy, 7) for i : 1 .. 100000     if screen (round (x), round (y)) = true then         drawdot (round (x), round (y), 0)         dx := (ptx (Rand.Int (1, n)) - x) * r         dy := (pty (Rand.Int (1, n)) - y) * r         if (x + dx) > 1 and (x + dx) < maxx and (y + dy) > 1 and (y + dy) < maxy then             if screen (round (x + dx), round (y + dy)) then                 x := x + dx                 y := y + dy             end if         end if     end if end for

MOD Edit: interesting... looks cool too +15Bits

Posted: Mon Mar 31, 2003 8:20 pm   Post subject: (No subject)

just a question catalyst, but how long have you been programming... and why have you only limited to turing? you're too good for just turing...
Catalyst

Posted: Mon Mar 31, 2003 9:58 pm   Post subject: (No subject)

ive been programming since october, and am currently learning other languages (c++,java and vb)
yuethomas

Posted: Tue Apr 01, 2003 11:47 pm   Post subject: (No subject)

October? Man, you're a natural.

I've been programming since grade 2 (in other words, 9 years) and I still can't make the 3d engine like you did.

(Well, I'm not into graphics, but that's beside the point)
Vicous

Posted: Thu Apr 03, 2003 11:00 am   Post subject: (No subject)

wow, 3d graphics make my head hurt lol
UraniumLobster

Posted: Wed Sep 12, 2007 9:36 am   Post subject: RE:Chaos Game

I onll wish I could do half the things you guys do... haha Im completely new!
Clayton

Posted: Wed Sep 12, 2007 3:53 pm   Post subject: RE:Chaos Game

So.... old...
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 7 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: