pygambit.gambit.Game.relabel_outcomes#
- Game.relabel_outcomes(labels: Mapping[str, str], strict: bool = True) None#
Simultaneously reassign the labels of the game’s outcomes.
labels maps current outcome labels to their replacements. The reassignment is simultaneous, so labels can be swapped directly, e.g.
{"a": "b", "b": "a"}.Added in version 17.0.0.
- Parameters:
labels (Mapping[str, str]) – A mapping from current outcome 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 an outcome of the game, and unknown keys raise
KeyError. If False, unknown keys are ignored.
- Raises:
KeyError – When strict is True, if a key of labels matches no outcome of the game.
TypeError – If labels is not a mapping, or any key or value is not a string.
ValueError – If a key of labels matches more than one outcome; or if any replacement label is empty, is not a valid label, or would result in a duplicate label.
UndefinedOperationError – If the game is in action-graph representation, where outcomes are not represented explicitly.
See also
relabel_playersSimultaneously reassign the labels of the game’s players.
relabel_strategiesChange the labels of a player’s strategies.
