pygambit.gambit.Game.relabel_strategies#
- Game.relabel_strategies(player: str, labels: Mapping[str, str], strict: bool = True) None#
Simultaneously reassign the labels of player’s strategies.
labels maps current strategy labels to their replacements. The reassignment is simultaneous, so labels can be swapped directly, e.g.
{"1": "2", "2": "1"}. Strategies are not re-ordered: each relabelled strategy keeps its position. After the operation, the player’s strategy labels must be nonempty and unique.Added in version 17.0.0.
- Parameters:
player (str) – The label of the player whose strategies to relabel.
labels (Mapping[str, str]) – A mapping from current strategy labels to replacement labels. Entries whose key equals their value are ignored.
strict (bool, default True) – If True, every key of labels must be the label of a strategy of player, and unknown keys raise
KeyError. If False, unknown keys are ignored.
- Raises:
KeyError – If no player in the game has label player; or, when strict is True, if a key of labels matches no strategy of player.
TypeError – If labels is not a mapping, or any key or value is not a string.
UndefinedOperationError – If the game has a tree representation, where strategies are derived from the tree.
ValueError – If a key of labels matches more than one strategy of player; or if any replacement label is empty, is not a valid label, or would result in a duplicate label for the player.
See also
relabel_actionsChange the labels of actions at an information set.
