Initialize an L-System interpreter with the given commandset and turtle config.
(self, commandset, stepsize, angle)
| 32 | commandsets = frozenset(["default"]) |
| 33 | |
| 34 | def __init__(self, commandset, stepsize, angle): |
| 35 | """Initialize an L-System interpreter with the given commandset and turtle config.""" |
| 36 | if commandset not in self.commandsets: |
| 37 | raise ValueError(f"{commandset=} not in {self.commandsets}.") |
| 38 | self.commandset = commandset |
| 39 | self.turtle = Turtle() |
| 40 | self.stepsize = stepsize |
| 41 | self.angle = angle |
| 42 | self.drawing = True |
| 43 | self.orientation_changed = False |
| 44 | self.active_line = [] |
| 45 | self.stack = [] |
| 46 | |
| 47 | def tokenize(self, commands: io.TextIOWrapper) -> Tokens: |
| 48 | """Tokenize the given input using the configured commandset.""" |