Ok, I'm really proud of this one. It's inspired by LaT3x's CHEMICAL, which is amazingly cool. I wanted to expirment with a non-organic CDFG, and I thought generating chemical structures would be a cool idea. I hade benzene rings in there, but I couldn't get them to look very good in the structure. I also wanted to put in actual letters for atom names ('c', 'o', and 'h', really, the organic ones), but the random rotation made them look not so good. PLease feel free to play with the code, and post your results.
startshape node
rule branch 5{
bond {}
node { y 3 }
}
//FREE ELECTRONS
rule branch {
CIRCLE {s .2 y .75 x -.2}
CIRCLE {s .2 y .75 x .2}
}
//SINGLE BOND
rule bond{
line8 { y 1.5 r 90 }
}
//DOUBLE BOND
rule bond {
line8 { x .2 y 1.5 r 90 }
line8 { x -.2 y 1.5 r 90 }
}
rule node 2 {
atom {}
branch { r 60}
}
rule node 2 {
atom {}
branch { r -60}
}
rule node {
atom {}
branch { r -60}
branch { r 60 }
}
rule node .1 {
atom {}
}
rule atom {
CIRCLE {}
CIRCLE { b 1 s .8 }
}
rule line2 {
SQUARE { x -.25 size .5 }
SQUARE { x .25 size .5 }
}
rule line4 {
line2 { x -.25 size .5 }
line2 { x .25 size .5 }
}
rule line8 {
line4 { x -.25 size .5 }
line4 { x .25 size .5 }
}