File: ltree.py

package info (click to toggle)
minetest-mod-pycraft 0.22-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,744 kB
  • sloc: python: 79,282; makefile: 10
file content (29 lines) | stat: -rwxr-xr-x 514 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#
# Code under the MIT license by Alexander Pruss
#

import lsystem
from mcturtle import *

t = Turtle()
t.pendelay(0)
t.penblock(WOOD)
t.turtle(None)
t.pitch(90)

rules = {'L':'[^FL]>[^FL]>[^FL]'}
axiom = 'FL'

dictionary = {
  'F': lambda: t.go(10),
  '+': lambda: t.yaw(90),
  '-': lambda: t.yaw(-90),
  '^': lambda: t.pitch(20),
  '&': lambda: t.pitch(-20),
  '>': lambda: t.roll(120),
  '<': lambda: t.roll(-120),
  '[': lambda: t.push(),
  ']': lambda: t.pop()
  }

lsystem.lsystem(axiom,rules,dictionary,5)