stp.play.pure_play
This module contains PurePlay.
Module Contents
Classes
A stateless play that uses the same tactics for the entire lifetime. |
- class stp.play.pure_play.PurePlay(tactics: stp.play.TacticsEnum, ctx: stp.play.Ctx)
Bases:
stp.play.IPlay
[PurePlay.Prop
],abc.ABC
A stateless play that uses the same tactics for the entire lifetime.
- class Prop
- tactic_props: Dict[Type[stp.tactic.ITactic], Any]
- __slots__ = ['_role_assignment', 'tactics']
- _role_assignment: stp.role.assignment.IRoleAssignment
- tactic: stp.play.TacticsEnum
- tick(world_state: stp.rc.WorldState, prev_results: stp.role.assignment.FlatRoleResults, props: Prop) Tuple[stp.role.assignment.FlatRoleResults, List[stp.action.IAction]]
Performs one “tick” of the specified play.
- This should:
Collect all the role requests from the tactics
Perform role assignment
Gives each tactic its assigned roles and getting a list of skills.
Return the list of skills obtained.
- Parameters:
world_state – The current state of the world.
prev_results – The previous results of role assignment.
props – Props from compute_props. This should be “const”, as all
mutations should happen in compute_props. :return: The list of skill to run.
- collect_role_requests(world_state: stp.rc.WorldState) stp.play.RoleRequests
Collects the role requests from each tactic. :param world_state: The current WorldState. :return: The collected play.RoleRequests.
- get_actions_from_tactics(flat_results: stp.role.assignment.FlatRoleResults, prop: Prop) List[stp.action.IAction]
Passes the roles assigned from role assignment to the correct tactic. :param flat_results: The results of role assignment. :param prop: The props of the play. This should be “const”. :return: The list of skills for each tactic.