> For the complete documentation index, see [llms.txt](https://computational-thinking-in-room11.gitbook.io/room-112-dhs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://computational-thinking-in-room11.gitbook.io/room-112-dhs/text-based-programming/coloring-a-fractal/spirals.md).

# Fractal Programming

Variables and  Repetition and Procedures

.A geometric shape that can be subdivided in parts, each of which is (at least approximately) a reduced/size copy of the whole

![Fractals ](https://2507214486-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LpUPSf3tCxHePJxNjfg%2F-LzrIPbLlAAFjF5ThG7P%2F-LzrIW-jbc75qDi_jOiX%2Fimage.png?alt=media\&token=26ccbd76-08ef-47c1-989d-f011eb1ff3cd)

![Extension: Research the Golden Ratio & Incorporate it into your fractal design](https://2507214486-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LpUPSf3tCxHePJxNjfg%2F-LzwN1Hg1noIZuU_i64q%2F-LzwNAa4EzgOck8soIbA%2Fimage.png?alt=media\&token=f2535586-21c6-44b2-b6b1-68a4e745f713)

## Basic Spiral

```
spiral = (size) ->
    if size > 0
        fd size * 10
        rt 90
        spiral  size - 1
        lt 90
        bk size * 10
        
```

This procedure develops the basic spiral code. If the size is 5, then the code will run 5 times, each time being 1 step smaller than the first&#x20;

Notice that we are calling the "spiral" inside of the code - see Line 5

Network Notebook: What is the result of line 7 `bk size * 10`? Does it relate to symmetry? Identify the `variable` in this code and explain (in english) both the value it holds AND how that value is updated when the `seed` procedure is called&#x20;

**Recursive Kolam**

Network Notebook: Define Kolam and sketch one

![](https://2507214486-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LpUPSf3tCxHePJxNjfg%2F-LzwMIwBTTdS8xITPyUK%2F-LzwMd649qrYx1H3qTfP%2Fimage.png?alt=media\&token=4ab1e9a2-f132-49ad-8703-7137d1602f20)

```
movexy -101,250
pen black, 1
speed  2

seed = (num) ->
    if num > 13
        for [1..4]
        rt 90
        fd num
    fill random color
    lt 90
    seed(num/2)
    
seed(160)
jumpto 98,51
seed(160)
ht()
```

![How does the output change as num/2?](https://2507214486-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LpUPSf3tCxHePJxNjfg%2F-LzrMZUVaK7RRB1DIx0A%2F-LzrMcpYSOSRvBIHREUO%2Fimage.png?alt=media\&token=b89fb542-dac0-461e-a038-6fb3fc032f1f)

This assignment based on lessonplans found at <https://manual.pencilcode.net/home/pdf/110-Chapter10.pdf>
