Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Fractals

Name: Anonymous 2006-08-11 13:18

#!/usr/bin/env ruby

sets = [[0.824074, 0.281428, -0.212346,  0.864198, -1.882290, -0.110607],
        [0.088272, 0.520988, -0.463889, -0.377778,  0.785360,  8.095795]]

x, y = 1.0, 1.0

100_000.times do
  set = rand <= 0.8 ? sets[0] : sets[1]

  x, y = [set[0] * x + set[1] * y + set[4],
          set[2] * x + set[3] * y + set[5]]

  puts "#{x} #{y}"
end

Name: Anonymous 2006-08-11 16:03

Hai?

Name: Anonymous 2006-08-11 16:57

This outputs a long column of numbers. Why would I want that.

Name: Anonymous 2006-08-11 16:58

>>3

You pipe them to a plotter.

Name: Anonymous 2006-08-11 17:26

Name: Anonymous 2006-08-15 8:01

i remember when we made a fractal generator in java at school. slow as fuck.

Name: Anonymous 2006-08-15 11:53

Oh please! There are 148 posts in a fucking hello world thread, but no one has written any code replies for this?

Name: Anonymous 2006-08-15 12:11

>>7
this is /prog/. what the fuck do you expect?

Name: Anonymous 2006-08-15 12:14

>>8
I expected at least some people with programming ability exceeding "hello word" and a fondness for pretty pictures.

Name: Anonymous 2006-08-15 17:28

>>9
I've written two fractal generators and I surely love fractals, but I'm a lazy ass and come here just to post a few short posts about /opt or rant.

Name: Anonymous 2006-08-15 18:09

LAWL, DOGS.

(defun iterate (point set)
  (list (+ (* (nth 0 set) (first  point))
           (* (nth 1 set) (second point))
           (nth 4 set))
        (+ (* (nth 2 set) (first  point))
           (* (nth 3 set) (second point))
           (nth 5 set))))

(defun dragon (num-iterations)
  (do ((sets '((0.824074 0.281428 -0.212346  0.864198 -1.882290 -0.110607)
               (0.088272 0.520988 -0.463889 -0.377778  0.785360  8.095795)))
       (current-iteration 0 (incf current-iteration))
       (point '(1.0 1.0) (iterate point
                                  (nth (if (<= (random 100) 80)
                                           0 1)
                                       sets)))
       (result '()))
      ((equal current-iteration num-iterations) result)
    (setf result (cons point result))))

Name: Anonymous 2009-01-14 14:00

lol tripfags

Name: Anonymous 2009-03-06 7:28


The Scheme Programming Language   and development environment   But it also   has the advantage   that its iterators   behave better than   that shitty toy?

Name: Anonymous 2010-06-27 12:58

ur gay

Name: Anonymous 2010-06-27 13:52

my homework is to read the first chapter of SICP: Can someone do that for me please so I don't have to??

Name: Anonymous 2011-02-02 22:43

<

Name: Sgt.Kabu븳ҕkiman鴋 2012-05-28 19:59

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List