@@ -604,6 +604,10 @@ int BoardHistory::numberOfKoHashOccurrencesInHistory(Hash128 koHash, const KoHas
604604 return count;
605605}
606606
607+ float BoardHistory::getCompleteWhiteBonus () const {
608+ return whiteBonusScore + whiteHandicapBonusScore + rules.komi ;
609+ }
610+
607611float BoardHistory::whiteKomiAdjustmentForDraws (double drawEquivalentWinsForWhite) const {
608612 // We fold the draw utility into the komi, for input into things like the neural net.
609613 // Basically we model it as if the final score were jittered by a uniform draw from [-0.5,0.5].
@@ -614,7 +618,7 @@ float BoardHistory::whiteKomiAdjustmentForDraws(double drawEquivalentWinsForWhit
614618}
615619
616620float BoardHistory::currentSelfKomi (Player pla, double drawEquivalentWinsForWhite) const {
617- float whiteKomiAdjusted = whiteBonusScore + whiteHandicapBonusScore + rules. komi + whiteKomiAdjustmentForDraws (drawEquivalentWinsForWhite);
621+ float whiteKomiAdjusted = getCompleteWhiteBonus () + whiteKomiAdjustmentForDraws (drawEquivalentWinsForWhite);
618622
619623 if (pla == P_WHITE )
620624 return whiteKomiAdjusted;
@@ -750,7 +754,7 @@ void BoardHistory::endAndScoreGameNow(const Board& board, Color area[Board::MAX_
750754 whiteBonusScore += (presumedNextMovePla == P_WHITE ? 0 .5f : -0 .5f );
751755 }
752756
753- setFinalScoreAndWinner (static_cast <float >(boardScore) + whiteBonusScore + whiteHandicapBonusScore + rules. komi );
757+ setFinalScoreAndWinner (static_cast <float >(boardScore) + getCompleteWhiteBonus () );
754758 isScored = true ;
755759 isNoResult = false ;
756760 isResignation = false ;
@@ -786,7 +790,7 @@ bool BoardHistory::endGameIfReasonable(const Board& board, const bool checkAllPa
786790 }
787791
788792 if (!reasonableMoveExist) {
789- finalWhiteScore = board.numBlackCaptures - board.numWhiteCaptures + whiteBonusScore + whiteHandicapBonusScore + rules. komi ;
793+ finalWhiteScore = board.numBlackCaptures - board.numWhiteCaptures + getCompleteWhiteBonus () ;
790794 }
791795 }
792796
@@ -834,7 +838,7 @@ bool BoardHistory::endGameIfReasonable(const Board& board, const bool checkAllPa
834838 hasButton = false ;
835839 whiteBonusScore += (presumedNextMovePla == P_WHITE ? 0 .5f : -0 .5f );
836840 }
837- setFinalScoreAndWinner (boardScore + whiteBonusScore + whiteHandicapBonusScore + rules. komi );
841+ setFinalScoreAndWinner (boardScore + getCompleteWhiteBonus () );
838842 isScored = true ;
839843 isNoResult = false ;
840844 isResignation = false ;
@@ -1100,7 +1104,7 @@ void BoardHistory::makeBoardMoveAssumeLegal(Board& board, Loc moveLoc, Player mo
11001104 isGameFinished = true ;
11011105 isPastNormalPhaseEnd = false ;
11021106 const auto whiteMinusBlackScore = static_cast <float >(board.numBlackCaptures - board.numWhiteCaptures );
1103- setFinalScoreAndWinner (whiteMinusBlackScore + whiteBonusScore + whiteHandicapBonusScore + rules. komi );
1107+ setFinalScoreAndWinner (whiteMinusBlackScore + getCompleteWhiteBonus () );
11041108 }
11051109 } else {
11061110 if (moveLoc != Board::PASS_LOC )
0 commit comments