MCPcopy Create free account
hub / github.com/ActiveState/code / L_system

Function L_system

recipes/Python/577159_LSystem_Fractals/recipe-577159.py:10–23  ·  view source on GitHub ↗
(level, initial_state, trgt, rplcmnt, trgt2, rplcmnt2)

Source from the content-addressed store, hash-verified

8
9# generate the fractal drawing string
10def L_system(level, initial_state, trgt, rplcmnt, trgt2, rplcmnt2):
11 state = initial_state
12
13 for counter in range(level):
14 state2 = ''
15 for character in state:
16 if character == trgt:
17 state2 += rplcmnt
18 elif character == trgt2:
19 state2 += rplcmnt2
20 else:
21 state2 += character
22 state = state2
23 return state
24
25def draw_fractal(length, numAngle, level, initial_state, trgt, rplcmnt, trgt2, rplcmnt2):
26 global imgx, imgy

Callers 1

draw_fractalFunction · 0.85

Calls 1

rangeFunction · 0.85

Tested by

no test coverage detected