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:
objectA single turtle command with its typed parameters.
Compound ARC commands use
angleto encode the rotation amount androtation_typeto indicate the axis. UseRotationTypemembers (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:
EnumThe 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'¶
-
NONE =
- cmd_type : TurtleCommandType¶
-
radius : float | None =
None¶
-
steps : int | None =
None¶
-
twist : float | None =
None¶
-
roll : float | None =
None¶
-
reverse : bool =
False¶
-
is_compound : bool =
False¶
-
sub_commands : list[TurtleCommand] | None =
None¶
-
rotation_type : RotationType =
''¶
- class pybosl2.turtle.commands.TurtleCommandType(*values)[source]¶
Bases:
EnumTurtle 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'¶
-
MOVE =