ritchie/engine/legal

Legal action and reaction enumeration. Candidates are generated from the state and then filtered through the same validators the engine uses, so every returned move is legal.

Values

pub fn actions(engine: engine.Engine) -> List(action.Action)

Every legal action by the current actor.

pub fn all_reactions(
  engine: engine.Engine,
) -> List(#(player.Player, List(reaction.Reaction)))

Every non-actor player and their legal reactions.

pub fn reactions(
  engine: engine.Engine,
  reactor: player.Player,
) -> List(reaction.Reaction)

Every legal reaction by reactor to the pending action.

✨ Search Document