pygambit.gambit.Game.set_strategies#

Game.set_strategies(player: str, strategies: list[str], drop: bool = False, add: bool = True) None#

Set the strategies of player to be strategies, matching by label.

  • An entry of strategies matching the label of a current strategy refers to

that strategy, keeping the outcomes at its contingencies; - An entry matching no current strategy creates a new strategy there, with no outcome at any of its contingencies; - A current strategy whose label is not in strategies is deleted, along with the outcomes at its contingencies. - Listing the current labels in a new order reorders the strategies, permuting the payoff table to match.

The defaults permit creation and forbid deletion.

Added in version 17.0.0: Subsumes and replaces Game.add_strategy and Game.delete_strategy.

Parameters:
  • player (str) – The label of the player whose strategies to set.

  • strategies (list of str) – The labels of the strategies the player is to have, in order. Must be nonempty and without duplicates; each label must be a valid, nonempty label.

  • drop (bool, default False) – Deleting strategies is destructive, so it must be explicitly confirmed: if any current strategy is missing from strategies and drop is False, the operation raises without modifying the game.

  • add (bool, default True) – If False, entries of strategies matching no current strategy raise.

Raises:
  • KeyError – If no player in the game has label player.

  • TypeError – If strategies is a string, or not an iterable of strings.

  • UndefinedOperationError – If the game has a tree representation, where the strategies are derived from the tree; or if strategies is empty.

  • ValueError – If a label in strategies is repeated, empty, or invalid.

See also

relabel_strategies

Change the labels of strategies, keeping the table unchanged.

set_actions

The analogous operation on the actions of an information set.