# Context Free - Generates Amazing Images!

**URL:** <https://forum.kirupa.com/t/context-free-generates-amazing-images/202956>\
**Category:** random\
**Created:** [October 6, 2006, 2:23am UTC](https://forum.kirupa.com/t/context-free-generates-amazing-images/202956 "2006-10-06T02:23:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [October 6, 2006, 2:23am UTC](https://forum.kirupa.com/t/context-free-generates-amazing-images/202956/1 "2006-10-06T02:23:06Z")

</div>

from [the site(click me im a link)](http://www.contextfreeart.org/wiki/)

> Chris Coyne created a small language for design grammars. These grammars are sets of non-deterministic rules to produce images. The images are surprisingly beautiful, often from very simple grammars.  
> to make something like this:  
>   
> the code looks something like this

```auto
startshape imagine

background { b 1 h 2 }

rule imagine {

weave {y 1}
weave {x -7}
weave {x 7 y 1}
weave {x -14 y 2}
}
rule weave {
trunk { sat 1 b .1 h 200 flip 90 y 1.1}
trunk { sat 1 b .1 h 10 x 2 y -.9}
trunk { sat 1 b .1 h 80 x -2 flip 90}
trunk { sat 1 b .1 h 300 x -4 y .8}
trunk { sat 1 b .1 h 120 x 1.5 y 2 flip 90}
trunk { sat 1 b .1 h 340 x 5.3 y -.5}
trunk { sat 1 b .1 h 40 x 4}
trunk { sat 1 b .1 h 240 x -3 y 3 flip 90}
trunk { sat 1 b .1 h 260 x -3.2 y 1.4}
trunk { sat 1 b .1 h 25 x -4.8}
trunk { sat 1 b .1 h 180 x -.4 y -1.7}
trunk { sat 1 b .1 h 330 x 2.3 y -2}
trunk { sat 1 b .1 h 135 x 1}

}

rule trunk 80{
    CIRCLE { s 1.5 }
    trunk { y 0.2 s 0.99 b .01 h 0.02 a -.009}
}

rule trunk {
   CIRCLE { } 
   SPIRAL { }
}

rule SPIRAL 100{
    CIRCLE { s 1.5}
    SPIRAL { y 0.2 r -2 s 0.99 b .01 h .02 a -.009}
}

rule SPIRAL 1{
     SPIRAL { }
     SPIRAL1 { }
}

rule SPIRAL1 {
    SPIRAL {flip 90}
}

```

Theres tons of example code on the site to learn from - its pretty logical stuff. It can even render off movies of the growth of the image - its gorgeous to watch…

:cool::cool:
