pooltool.ruleset.utils#
Overview#
Enum where members are also (and must be) strings |
|
Get list of ball IDs pocketed during the shot |
|
Get list of ball IDs that are in the pocketed state (by end of shot) |
|
Respot a ball |
|
Get the lowest ball on the table at start or end of shot |
|
Get the highest ball on the table at start or end of shot |
Classes#
Functions#
- pooltool.ruleset.utils.get_pocketed_ball_ids_during_shot(shot: pooltool.system.datatypes.System, exclude: Set[str] | None = None) List[str][source]#
Get list of ball IDs pocketed during the shot
See also get_pocketed_ball_ids
- Return type:
List[str]
- pooltool.ruleset.utils.get_pocketed_ball_ids(shot: pooltool.system.datatypes.System) List[str][source]#
Get list of ball IDs that are in the pocketed state (by end of shot)
See also get_pocketed_ball_ids_during_shot
- Return type:
List[str]
- pooltool.ruleset.utils.respot(shot: pooltool.system.datatypes.System, ball_id: str, x: float, y: float, z: float | None = None) None[source]#
Respot a ball
- Parameters:
z (Optional[float]) -- If not provided, z is set to the ball’s radius
Notes
FIXME check if respot position overlaps with ball
- pooltool.ruleset.utils.get_lowest_ball(shot: pooltool.system.datatypes.System, when: StateProbe) pooltool.objects.ball.datatypes.Ball[source]#
Get the lowest ball on the table at start or end of shot
- Parameters:
at_start -- If True, the lowest ball on the table at t=0 is calculated. If False, the lowest ball at the end of the shot (t=inf) is calculated. The latter returns a different result if the lowest ball on the table was pocketed
- Return type:
- pooltool.ruleset.utils.get_highest_ball(shot: pooltool.system.datatypes.System, at_start: bool) pooltool.objects.ball.datatypes.Ball[source]#
Get the highest ball on the table at start or end of shot
- Parameters:
at_start (bool) -- If True, the highest ball on the table at t=0 is calculated. If False, the highest ball at the end of the shot (t=inf) is calculated. The latter returns a different result if the highest ball on the table was pocketed
- Return type: