Skip to content

Enforce unique, nonempty labels for strategies#981

Merged
tturocy merged 6 commits into
gambitproject:masterfrom
d-kad:strategy-labels
Jul 9, 2026
Merged

Enforce unique, nonempty labels for strategies#981
tturocy merged 6 commits into
gambitproject:masterfrom
d-kad:strategy-labels

Conversation

@d-kad

@d-kad d-kad commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Issues closed by this PR

Description of the changes in this PR

Enforces label rules for strategies, following the same pattern as players. Strategies are a nonempty, unique-within-player scope, enforced in GameStrategyRep::SetLabel:

  • A strategy label must be nonempty, valid, and unique among a player's strategies; a violating label raises ValueError.
  • add_strategy now requires a label (no default, no auto-generation).

@tturocy

tturocy commented Jul 8, 2026

Copy link
Copy Markdown
Member

I've added a commit that ensures generation of a unique strategy label in the GUI.

However, I noticed duplicate strategy labels are not being checked on creating new strategies.

Comment thread src/pygambit/game.pxi Outdated
Comment thread src/games/gametable.cc Outdated
if (p_player->GetGame().get() != this) {
throw MismatchException();
}
auto strategy =

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as made on the player PR - the point of having a label that is required on initialisation is to provide a valid one.

@tturocy
tturocy merged commit 7d21fa6 into gambitproject:master Jul 9, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants