diff options
author | John Fultz <jfultz@wolfram.com> | 2016-07-20 11:48:15 -0500 |
---|---|---|
committer | John Fultz <jfultz@wolfram.com> | 2016-07-20 11:48:15 -0500 |
commit | d8e8ccf584be9bb6df91b4bba6541a7e32d25116 (patch) | |
tree | 23b57863da1a3836b07da5d6def67f863295f342 | |
parent | b0d66b0c578a1845900aba0747f4c4a30ccf76b2 (diff) |
More fixing of tile counts.
The tile counting code wasn't properly tracking challenged phonies.
Also, it could get off right at the beginning. I think I didn't see this
before because I was testing with an unusual game that started
off with a pass and a bingo.
-rw-r--r-- | game.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -779,11 +779,13 @@ bool GamePosition::incrementTurn(const History* history) const Quackle::PositionList positions(history->positionsFacedBy((*nextCurrentPlayer).id())); if (positions.size() > 0) m_tilesOnRack = positions.back().m_tilesOnRack; - else - // note...this can happen not just at the beginning of a game, but inside of a simming player engine + else if (m_turnNumber > 1) + { + // this can happen inside of a simming player engine // which doesn't have a full history list m_tilesOnRack = currentPlayer().rack().tiles().size(); - if (m_moveMade.action == Move::Place) + } + if (m_moveMade.action == Move::Place && !m_moveMade.isChallengedPhoney()) m_tilesOnRack -= m_moveMade.usedTiles().size(); if (m_tilesInBag == 0) { |