summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Fultz <jfultz@wolfram.com>2016-07-20 11:48:15 -0500
committerJohn Fultz <jfultz@wolfram.com>2016-07-20 11:48:15 -0500
commitd8e8ccf584be9bb6df91b4bba6541a7e32d25116 (patch)
tree23b57863da1a3836b07da5d6def67f863295f342
parentb0d66b0c578a1845900aba0747f4c4a30ccf76b2 (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.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/game.cpp b/game.cpp
index c4d366e..8e63ed5 100644
--- a/game.cpp
+++ b/game.cpp
@@ -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)
{