stp.role.cost

This module contains a variety of cost functions for convenience.

Module Contents

Classes

PickRobotById

Always select robot of robot_id (passed on init).

PickClosestToPoint

Always select closest robot to some target_point (passed on init).

PickFarthestFromPoint

Always select farthest robot to some target_point (passed on init).

PickClosestInFront

Select closest robot "in front" of the current one. (Assuming opp goal is front.)

class stp.role.cost.PickRobotById(robot_id: int)

Bases: stp.role.CostFn

Always select robot of robot_id (passed on init).

__call__(self, robot: stp.rc.Robot, world_state: stp.rc.WorldState) float
unassigned_cost_fn(self, prev_results: Any, world_state: stp.rc.WorldState) float
__repr__(self)
class stp.role.cost.PickClosestToPoint(target_point: numpy.ndarray)

Bases: stp.role.CostFn

Always select closest robot to some target_point (passed on init). Can get closest to ball by passing in world_state.ball.pos.

__call__(self, robot: stp.rc.Robot, world_state: stp.rc.WorldState) float
__repr__(self)
class stp.role.cost.PickFarthestFromPoint(target_point)

Bases: stp.role.CostFn

Always select farthest robot to some target_point (passed on init). Can get farthest from ball by passing in world_state.ball.pos.

__call__(self, robot: stp.rc.Robot, world_state: stp.rc.WorldState) float
__repr__(self)
class stp.role.cost.PickClosestInFront(target_point)

Bases: stp.role.CostFn

Select closest robot “in front” of the current one. (Assuming opp goal is front.)

__call__(self, robot: stp.rc.Robot, world_state: stp.rc.WorldState) float
__repr__(self)