pygambit.gambit.Game.set_event_actions#

Game.set_event_actions(event: Selector, probs: Mapping, drop: bool = False, add: bool = True) None#

Set the actions at the event that the node identified by event belongs to, to be the keys of probs, in order, with the given probability distribution.

A key of probs matching the label of a current action refers to that action, which keeps its subtrees; a key matching no current action creates a new action there, leading to a new terminal node at every member; a current action whose label is not a key of probs is deleted, along with the subtrees its branches lead to. Listing the current labels as keys in a new order reorders the actions as well as the children.

Unlike set_move_actions, the probability distribution is always declared as part of the operation, rather than inferred from the actions which remain: there is no way to reorder an event’s actions without also restating their probabilities.

event is a Selector (an H-built expression, evaluated against this game) that must resolve to exactly one node.

Added in version 17.0.0.

Parameters:
  • event (Selector) – A Selector resolving to a single node belonging to the event at which to set the actions.

  • probs (dict-like) – A mapping from the label of each action the event is to have, in order, to its probability. Must be nonempty, with valid, nonempty keys. Values must be non-negative numbers summing to exactly one.

  • drop (bool, default False) – Deleting actions is destructive, so it must be explicitly confirmed: if any current action is missing as a key of probs and drop is False, the operation raises without modifying the game.

  • add (bool, default True) – If False, keys of probs matching no current action raise.

Raises:
  • TypeError – If event is not a Selector; or if probs is not a mapping, or a key of probs is not a string.

  • UndefinedOperationError – If probs is empty, or if event resolves to a personal player’s information set rather than an event; use set_move_actions for a personal player’s move.

  • ValueError – If event does not resolve to exactly one node; if a key of probs is empty or invalid; if adding or deleting actions is not confirmed by add/drop; or if the values of probs are not non-negative numbers summing to exactly one.

See also

set_move_actions

The corresponding operation for the actions of a personal player’s move.

relabel_actions

Change the labels of actions, leaving the tree unchanged.