From d8e8ccf584be9bb6df91b4bba6541a7e32d25116 Mon Sep 17 00:00:00 2001 From: John Fultz Date: Wed, 20 Jul 2016 11:48:15 -0500 Subject: 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. --- game.cpp | 8 +++++--- 1 file 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) { -- cgit v1.2.3