Skip to content

Weird behavior when returning string from order.first() #586

@janKir

Description

@janKir

I misunderstood the instructions on how to use the custom order functions and returned the playerID (a string) instead of the playOrder index (a number) from a phase's order.first() function.

const phase = {
  moves: { ... },
  turn: {
    order: {
      first: (G) => G.firstPlayer
    }
  }
}

This also worked for the first move, and the correct player was set. This made it hard to detect where the upcoming unexpected behavior originated: When ending the first turn (and also phase), the second player was not the next player in playOrder as expected, but (in a 4 player game) was always either player "1" if the first player was player "0" or "2" or player "3" if the first player was player "1" or "3".

Despite the question why the app behaved like this, I would suggest making misuse of the first() function more clear or allow returning a string playerID with expected behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions