pygambit.gambit.Game.make_infoset#

Game.make_infoset(nodes: Selector | GroupedSelector, player: str, label: str | None = None) None#

Form nodes into a single information set belonging to player.

The nodes must all: (i) be nonterminal nodes of this game, (ii) have the same actions, with the same labels in the same order. They need not currently be personal decision nodes; nodes belonging to a chance event are converted, discarding their probabilities. Nodes are removed from whatever information sets or events they currently belong to; any of those which retain members after removal survive, keeping their labels. Infosets left with no members are deleted.

The structure of the tree is unchanged: no nodes are created or removed. This operation may introduce imperfect recall or absent-mindedness.

nodes is a Selector (an H-built expression, evaluated against this game and treated as a flat set of nodes) or a GroupedSelector (an H-built .by(…) expression, whose groups are pooled together into the one information set).

Added in version 17.0.0.

Parameters:
  • nodes (Selector or GroupedSelector) – The nodes to place in the information set. Nonempty; each node may be referenced only once.

  • player (str) – The label of the player to whom the information set belongs.

  • label (str, optional) – The label of the new information set. If specified, must be unique among the information sets of player after the operation. A label currently held by another of player’s information sets may be reused only if all members of that set are among nodes.

Raises:
  • TypeError – If nodes is not a Selector or GroupedSelector, or player is not of an accepted type.

  • KeyError – If player is a label matching no such object in the game.

  • UndefinedOperationError – If any of nodes is a terminal node, or if the game is not a tree.

  • ValueError – If nodes is empty or contains a repeated node; if the nodes do not all have the same actions in the same order; or if label is not unique among player’s information sets after the operation.