1
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
3
Name:
Anonymous
2006-08-11 16:57
This outputs a long column of numbers. Why would I want that.
4
Name:
Anonymous
2006-08-11 16:58
>>3
You pipe them to a plotter.
5
Name:
Anonymous
2006-08-11 17:26
6
Name:
Anonymous
2006-08-15 8:01
i remember when we made a fractal generator in java at school. slow as fuck.
7
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?
8
Name:
Anonymous
2006-08-15 12:11
>>7
this is /prog/. what the fuck do you expect?
9
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.
10
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.
11
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))))
13
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?
15
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??