Skip to content

Scenario player allocation changes when the caller mutates its focal mask #409

Description

@sylvesterkaczmarek

Reproduction

Scenario.__init__ retains the caller's is_focal sequence directly, although player roles and the background population are configured at construction.

Construct a scenario with mask = [True, False, True, False], then assign mask[:] = [False, True, False, True]. The existing scenario's action/observation/reward specs and timestep partitions switch to different players. Its background population still has the original roles. Clearing or extending the same list can also change the accepted focal action count after initialization.

This reproduces through the actual Scenario and Population implementations. It affects direct construction and callers of build_scenario that retain a mutable mask; ScenarioFactory already snapshots its own constructor input.

Expected behavior

Snapshot the player mask as a tuple during Scenario construction, just as the factory does. Later changes to caller-owned lists or NumPy arrays should not reassign player slots. Preserve action ordering, observation filtering, timestep routing and existing constructor/action-count validation for unchanged inputs.

This is distinct from the prior focal-action-count validation and the open empty-background-population changes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions