day22.lib package
Submodules
day22.lib.classes module
Classes for day22.
- class day22.lib.classes.BoxData(name: str, start_pos: Vector3, end_pos: Vector3)[source]
Bases:
object
A box in 3d space.
- property height: float
Height according to vpython.
- property length: float
Length according to vpython.
- name: str
- recursive_fall(already_falling: set[BoxData]) set[BoxData] [source]
Returns all boxes above us that fall if we fall.
- vbox: box | None = None
- property vpos: vector
Pos according to vpython.
- property width: float
Width according to vpython.
- property z_val_bot: int
Return lowest z value (self.start_pos.z).
- property z_val_top: int
Return maximum z value(self.end_pos.z).
- class day22.lib.classes.Matrix(z_height: int = 400, xy: int = 10)[source]
Bases:
object
3d matrix.
- can_fall_down(box: BoxData) bool [source]
Whether a given box can fall downwards.
- Parameters:
box (BoxData) – box to test
- Returns:
True if the box can fall.
- Return type:
bool
day22.lib.parsers module
Parse vectors/boxes from string to class.
day22.lib.vis module
Visualization classes.
- day22.lib.vis.bind_keys(on_key_down: Any) None [source]
Bind keyboard events, so that
enter
calls the given callback.
- day22.lib.vis.construct_box(box_data: BoxData, color: vector) box [source]
Constructs a vpython box from a box_data.
- Parameters:
box_data (BoxData) – box data to mimic
color (vpython.vector) – color of box for vis.
- Returns:
a vpython.box
- Return type:
vpython.box
Module contents
Library classes for day22.