Commands

The turtle command language: the command names and the typed parameter bag that carries them

The turtle command language: the command names and the typed parameter bag that carries them.

Shared by the 2-D and 3-D turtles and by the method form in _fluent.py – it lives in its own module so all three can import it without importing each other.

class pybosl2.turtle.commands.TurtleCommand(cmd_type, size=None, angle=None, radius=None, steps=None, center=None, grow=None, shrink=None, twist=None, roll=None, reverse=False, rollto=None, rrollto=None, lrollto=None, is_compound=False, sub_commands=None, rotation_type=RotationType.NONE)[source]

Bases: object

A single turtle command with its typed parameters.

Compound ARC commands use angle to encode the rotation amount and rotation_type to indicate the axis. Use RotationType members (e.g. TurtleCommand.RotationType.LEFT).

Parameters:
cmd_type : TurtleCommandType

size : float | Point | None

angle : float | Point | None

radius : float | None

steps : int | None

center : Point | None

grow : float | Point | None

shrink : float | Point | None

twist : float | None

roll : float | None

reverse : bool

rollto : Point | None

rrollto : Point | None

lrollto : Point | None

is_compound : bool

sub_commands : list[TurtleCommand] | None

rotation_type : RotationType

class RotationType(*values)[source]

Bases: Enum

The rotation axis/direction for a compound ARC command.

NONE = ''
LEFT = 'left'
RIGHT = 'right'
UP = 'up'
DOWN = 'down'
XROT = 'xrot'
YROT = 'yrot'
ZROT = 'zrot'
ROT = 'rot'
TODIR = 'todir'
cmd_type : TurtleCommandType
size : float | Point | None = None
angle : float | Point | None = None
radius : float | None = None
steps : int | None = None
center : Point | None = None
grow : float | Point | None = None
shrink : float | Point | None = None
twist : float | None = None
roll : float | None = None
reverse : bool = False
rollto : Point | None = None
rrollto : Point | None = None
lrollto : Point | None = None
is_compound : bool = False
sub_commands : list[TurtleCommand] | None = None
rotation_type : RotationType = ''
class pybosl2.turtle.commands.TurtleCommandType(*values)[source]

Bases: Enum

Turtle movement command type.

MOVE = 'move'
UNTILX = 'untilx'
UNTILY = 'untily'
UNTILZ = 'untilz'
XMOVE = 'xmove'
YMOVE = 'ymove'
ZMOVE = 'zmove'
XYZMOVE = 'xyzmove'
JUMP = 'jump'
XJUMP = 'xjump'
YJUMP = 'yjump'
ZJUMP = 'zjump'
ANGLE = 'angle'
LENGTH = 'length'
SCALE = 'scale'
ADDLENGTH = 'addlength'
ARCSTEPS = 'arcsteps'
ROLL = 'roll'
RIGHT = 'right'
LEFT = 'left'
UP = 'up'
DOWN = 'down'
XROT = 'xrot'
YROT = 'yrot'
ZROT = 'zrot'
ROT = 'rot'
SETDIR = 'setdir'
ARCLEFT = 'arcleft'
ARCRIGHT = 'arcright'
ARCLEFTTO = 'arcleftto'
ARCRIGHTTO = 'arcrightto'
ARCUP = 'arcup'
ARCDOWN = 'arcdown'
ARCXROT = 'arcxrot'
ARCYROT = 'arcyrot'
ARCZROT = 'arczrot'
ARCTODIR = 'arctodir'
ARCROT = 'arcrot'
REPEAT = 'repeat'
ARC = 'arc'