Skip to content

Commit

Permalink
Remove magic number for initial turn.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 571402316
Change-Id: I86b618ec2875c589e2d1ea5d688645ecdc6b12f7
  • Loading branch information
aaronriceg authored and lanctot committed Oct 12, 2023
1 parent a72aa73 commit 16962d4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions open_spiel/games/yacht/yacht.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ constexpr int kHighestDieRoll = 6;

// Possible Actions:
constexpr int kPass = 0;
constexpr int kInitialTurn = -1;

// Facts about the game
const GameType kGameType{/*short_name=*/"yacht",
Expand Down Expand Up @@ -127,7 +128,7 @@ YachtState::YachtState(std::shared_ptr<const Game> game)
: State(game),
cur_player_(kChancePlayerId),
prev_player_(kChancePlayerId),
turns_(-1),
turns_(kInitialTurn),
player1_turns_(0),
player2_turns_(0),
dice_({}),
Expand Down Expand Up @@ -165,7 +166,7 @@ int YachtState::DiceValue(int i) const {

void YachtState::DoApplyAction(Action move) {
if (IsChanceNode()) {
if (turns_ == -1) {
if (turns_ == kInitialTurn) {
// First turn.
SPIEL_CHECK_TRUE(dice_.empty());
int starting_player = std::rand() % kNumPlayers;
Expand Down

0 comments on commit 16962d4

Please sign in to comment.