Skip to content

Maybe: Use player ID as state variable for current player instead of index? #31

Open
@LearningNerd

Description

@LearningNerd

Currently, the current player or current turn is held in a variable named turnIndex, which holds the index of the current player object in the gameState.players array. But since players can join and leave at any time, that index changes -- and not only when the turn changes! It would be more intuitive and probably more logical to store the ID of the current player, which only changes when the turn changes.

My only question is this: will this create more work for me, code-wise? (Because it's easier to access stuff in an array using an index, compared to searching for an ID within an object in that array. But I already have a helper function for that, so it probably isn't a big deal.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions