![]() |
| Rainbow! ... and cake |
![]() |
| Triple helix near an overworld plate |
![]() |
| Home, satellite dish and "Craft" |
The rainbow, triple helix and satellite dish were all planned using Lisp. Here's some Lisp code you can use to plan rainbows:
(loop with freq = (list)
and reach = (1+ 20)
and width = 8
for j from reach downto 0
do (loop for i from (- reach) to reach
for r = (round (sqrt (+ (square i) (square j))))
for c = (cond ((= i j 0) #\+)
((< r (- reach width)) #\-)
((<= r (1- reach)) (- r (- reach width)))
(t #\Space))
when (not (eql #\Space c))
do (aif (cdr (assoc c freq))
(incf (car it))
(push (list c 1) freq))
when (or (minusp i) (not (eql #\Space c))) do (princ c))
do (terpri)
finally (return freq))
and reach = (1+ 20)
and width = 8
for j from reach downto 0
do (loop for i from (- reach) to reach
for r = (round (sqrt (+ (square i) (square j))))
for c = (cond ((= i j 0) #\+)
((< r (- reach width)) #\-)
((<= r (1- reach)) (- r (- reach width)))
(t #\Space))
when (not (eql #\Space c))
do (aif (cdr (assoc c freq))
(incf (car it))
(push (list c 1) freq))
when (or (minusp i) (not (eql #\Space c))) do (princ c))
do (terpri)
finally (return freq))
It produces output like this (this one's a small version to fit in the width of the blog):
777777777
777666666666777
7766655555555566677
77665554444444445556677
7665544433333333344455667
766544433322222223334445667
76554433222111111122233445567
7655433221110000000111223345567
7655433211000-------0001123345567
766543321100-----------001123345667
7654332100---------------0012334567
7654432100-----------------0012344567
765432110-------------------011234567
765443210---------------------012344567
765432100---------------------001234567
76543210-----------------------01234567
765433210-----------------------012334567
76543210-------------------------01234567
76543210-------------------------01234567
76543210-------------------------01234567
76543210------------+------------01234567
((#\+ 1) (#\- 256) (0 45) (1 45) (2 43) (3 57) (4 57) (5 57) (6 59) (7 57))
The last bit is a count of each block type so you know how much to gather of each type. Three dimensional objects like the dish and triple helix use more code which I can post if people are interested.
P.S. Don't spend too much time playing computer games.
777666666666777
7766655555555566677
77665554444444445556677
7665544433333333344455667
766544433322222223334445667
76554433222111111122233445567
7655433221110000000111223345567
7655433211000-------0001123345567
766543321100-----------001123345667
7654332100---------------0012334567
7654432100-----------------0012344567
765432110-------------------011234567
765443210---------------------012344567
765432100---------------------001234567
76543210-----------------------01234567
765433210-----------------------012334567
76543210-------------------------01234567
76543210-------------------------01234567
76543210-------------------------01234567
76543210------------+------------01234567
((#\+ 1) (#\- 256) (0 45) (1 45) (2 43) (3 57) (4 57) (5 57) (6 59) (7 57))
The last bit is a count of each block type so you know how much to gather of each type. Three dimensional objects like the dish and triple helix use more code which I can post if people are interested.
P.S. Don't spend too much time playing computer games.






















