MCPcopy Index your code
hub / github.com/python/cpython / main

Function main

Lib/turtledemo/lindenmayer.py:46–111  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44
45
46def main():
47 ################################
48 # Example 1: Snake kolam
49 ################################
50
51
52 def r():
53 right(45)
54
55 def l():
56 left(45)
57
58 def f():
59 forward(7.5)
60
61 snake_rules = {"-":r, "+":l, "f":f, "b":"f+f+f--f--f+f+f"}
62 snake_replacementRules = {"b": "b+f+b--f--b+f+b"}
63 snake_start = "b--f--b--f"
64
65 drawing = replace(snake_start, snake_replacementRules, 3)
66
67 reset()
68 speed(3)
69 tracer(1,0)
70 ht()
71 up()
72 backward(195)
73 down()
74 draw(drawing, snake_rules)
75
76 from time import sleep
77 sleep(3)
78
79 ################################
80 # Example 2: Anklets of Krishna
81 ################################
82
83 def A():
84 color("red")
85 circle(10,90)
86
87 def B():
88 from math import sqrt
89 color("black")
90 l = 5/sqrt(2)
91 forward(l)
92 circle(l, 270)
93 forward(l)
94
95 def F():
96 color("green")
97 forward(10)
98
99 krishna_rules = {"a":A, "b":B, "f":F}
100 krishna_replacementRules = {"a" : "afbfa", "b" : "afbfbfbfa" }
101 krishna_start = "fbfbfbfb"
102
103 reset()

Callers 1

lindenmayer.pyFile · 0.70

Calls 8

tracerFunction · 0.85
downClass · 0.85
sleepFunction · 0.85
leftClass · 0.85
replaceFunction · 0.70
drawFunction · 0.70
htFunction · 0.50
upClass · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…