pygambit.gambit.Game.relabel_players#
- Game.relabel_players(labels: Mapping[str, str], strict: bool = True) None#
Simultaneously reassign the labels of the game’s players.
labels maps current player labels to their replacements. The reassignment is simultaneous, so labels can be swapped directly. Players are not re-ordered: each relabelled player keeps its position.
The chance player is not part of the operation: its label is reserved, and a key of labels equal to it raises
ValueErroreven when strict is False.Added in version 17.0.0.
- Parameters:
labels (Mapping[str, str]) – A mapping from current player 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 player 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 player 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 player; if a key of labels is the label of the chance player; or if any replacement label is empty, is not a valid label, would result in a duplicate label, or (in an extensive game) is the reserved label of the chance player.
See also
relabel_actionsChange the labels of actions at an information set.
relabel_strategiesChange the labels of a player’s strategies.
