Mariner 9 code

If you have a design you're proud of, share the cfdg file here. It's also a good place to ask for feedback and collaborate.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
Alan
Posts: 3
Joined: Fri Jul 29, 2005 1:57 am
Location: Templepatrick

Mariner 9 code

Post by Alan »

The digital code used to send back signals from Mars by Mariner 9 can easily be designed recursively.
One part of the algoritm needs the inversion of a pattern of 1s and 0s. Due to the way color is representsd in CDFG this is easy.
Choose a hue for repenenting 1 and for 0 choose a hue 180 away. Now redrawing any pattern of 1s and 0s with a setting h 180 will swap the colors.
The code could probable be more compact but I wanted a definite number of recursions. It is trivial to extend the code to those having more bits in each codeword.

Code: Select all

startshape MARINER{color}


rule CODE0{
SQUARE{x 0 y 0 h 0 sat 1 b 1}
}

rule CODE1{
CODE0{x 0 y 0}
CODE0{x 0 y 1}
CODE0{x 1 y 1}
CODE0{x 1 y 0  h 180 sat 1 b 1}
}

rule CODE2{
CODE1{x 0 y 0}
CODE1{x 0 y 2}
CODE1{x 2 y 2}
CODE1{x 2 y 0  h 180 sat 1 b 1}
}

rule CODE4{
CODE2{x 0 y 0}
CODE2{x 0 y 4}
CODE2{x 4 y 4}
CODE2{x 4 y 0  h 180 sat 1 b 1}
}

rule CODE8{
CODE4{x 0 y 0}
CODE4{x 0 y 8}
CODE4{x 8 y 8}
CODE4{x 8 y 0  h 180 sat 1 b 1}
}

rule CODE16{
CODE8{x 0 y 0}
CODE8{x 0 y 16}
CODE8{x 16 y 16}
CODE8{x 16 y 0  h 180 sat 1 b 1}
}

rule CODE32{
CODE16{x 0 y 0}
CODE16{x 0 y 32}
CODE16{x 32 y 32}
CODE16{x 32 y 0  h 180 sat 1 b 1}
}

rule MARINER{
CODE32{x 0 y 0}
CODE32{x 0 y 64}
CODE32{x 64 y 64}
CODE32{x 64 y 0  h 180 sat 1 b 1}
}
[img]
http://chriscoyne.com/gallery/uploads// ... 971451.png
[/img] :)

User avatar
lagroue
Posts: 114
Joined: Wed Jul 06, 2005 11:33 pm
Location: Paris, France
Contact:

Post by lagroue »

Actually, this is a topic you could write further about - maybe I'm the only one missing the point, but the mariner inversion stuff you're talking about only raised interrogations in me.

Still, this code starts with contrasted lines, then goes on with grey goo as expected, and eventually produces a black rectangle - this final step is surprising (maybe a bug ?) :

Code: Select all

startshape scene 

rule scene { 
   totoBW { } 
   totoCOLOR { x 1} 
} 

rule totoBW { 
   SQUARE { } 
   totoBW [ s 1 0.5 y -0.5 b -1] 
   totoBW [ s 1 0.5 y 0.5 b 1] 
} 

rule totoCOLOR { 
   SQUARE { b 1 sat 1} 
   totoCOLOR [ s 0.5 1 x -0.5 ] 
   totoCOLOR [ s 0.5 1 x 0.5 hue 180] 
}
Last edited by lagroue on Wed Aug 03, 2005 5:38 am, edited 2 times in total.

User avatar
lagroue
Posts: 114
Joined: Wed Jul 06, 2005 11:33 pm
Location: Paris, France
Contact:

Post by lagroue »

This code does some binary computation, but doesn't show the "fade to black" effect :

Code: Select all

startshape scene

rule scene {
	toto { s 0.05 1}
}

rule toto {
	SQUARE { }
	toto [ x 1 s 1 0.5 y -0.5 b -1]
	toto [ x 1 s 1 0.5 y 0.5 b 1]
}

Post Reply