Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

In case of a tie, winner is decided on a coin flip #722

Description

@TheoPannetier

Depends

Context

If two or more players have the same size by the end of the game, the winner should be decided on a coin flip amongst them.

Test

  #ifdef FIX_ISSUE_722
  // (722) In case of a tie, winner is decided on a coin flip
  {
      const int a_seed = 5;
      const int another_seed = 6; // change if this picks the same winner

      game a_game(game_options{a_seed});
      player &player_two = a_game.get_player(1);
      player_two.grow();
      player &player_three = a_game.get_player(2);
      player_three.grow();
      assert(a_game.who_is_winning() != 0);

      game another_game(game_options{another_seed});
      player &other_player_two = another_game.get_player(1);
      other_player_two.grow();
      player &other_player_three = another_game.get_player(2);
      other_player_three.grow();
      assert(another_game.who_is_winning() != 0);

      assert(a_game.who_is_winning != another_game.who_is_winning());
  }
  #endif // FIX_ISSUE_722

Activity

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

Metadata

Metadata

Labels

juniorSuitable for junior devs

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions