ritchie/model/history
History of a round, with or without intermediate states preserved.
Types
A turn’s action and the resolved (highest-priority) reaction, if any. Multi-ron is represented separately.
pub type ActionReaction {
ActionReaction(
actor: player.Player,
action: action.Action,
reactor_reaction: option.Option(
#(player.Player, reaction.Reaction),
),
)
}
Constructors
-
ActionReaction( actor: player.Player, action: action.Action, reactor_reaction: option.Option( #(player.Player, reaction.Reaction), ), )
A turn’s action and reaction (if any), together with the resolved result and the next core state from the engine. Multi-ron is represented separately.
pub type GameStep {
GameStep(
actor: player.Player,
action: action.Action,
reactor_reaction: option.Option(
#(player.Player, reaction.Reaction),
),
action_result: action_result.ActionResult,
next_state_core: option.Option(state.StateCore),
)
}
Constructors
-
GameStep( actor: player.Player, action: action.Action, reactor_reaction: option.Option( #(player.Player, reaction.Reaction), ), action_result: action_result.ActionResult, next_state_core: option.Option(state.StateCore), )
Full history of a round: the beginning and every turn’s GameStep.
pub type RoundHistory {
RoundHistory(
begin: boundary.RoundBegin,
steps: List(GameStep),
ron: List(Bool),
)
}
Constructors
-
RoundHistory( begin: boundary.RoundBegin, steps: List(GameStep), ron: List(Bool), )Arguments
- ron
-
Which players declared ron at the last step. This can encode multi-ron.
Action-only history of a round: states are implicit from the game logic. This is missing the states after each turn.
pub type RoundHistoryLite {
RoundHistoryLite(
begin: boundary.RoundBegin,
action_reactions: List(ActionReaction),
ron: List(Bool),
)
}
Constructors
-
RoundHistoryLite( begin: boundary.RoundBegin, action_reactions: List(ActionReaction), ron: List(Bool), )Arguments
- ron
-
Which players declared ron at the last action, encoding multi-ron.
Values
pub fn apply_step(
current: state.State,
step: GameStep,
) -> state.State
Applies a step to the state if the step has a next core state.
pub fn apply_steps(
current: state.State,
steps: List(GameStep),
) -> state.State
Applies a sequence of steps to the state.