Closed gsiems closed 1 year ago
In the _estimatedTricksForSpades function of the spades_ai.dart file it appears that the calculated bid is too low at times.
I believe that adding the line previousTopRankIndex = ranks[i].index to the end of the numRanksToCheck loop fixes the issue:
previousTopRankIndex = ranks[i].index
double _estimatedTricksForSpades(List<Rank> ranks) { if (ranks.isEmpty) { return 0; } // Look at gaps for first 3 spades, assume 4th spade and beyond are good. int gaps = 0; int numRanksToCheck = min(3, ranks.length); int previousTopRankIndex = Rank.ace.index + 1; double gapPenalty = 0; for (int i = 0; i < numRanksToCheck; i++) { gaps += previousTopRankIndex - ranks[i].index - 1; gapPenalty += (gaps == 0) ? 0 : (gaps == 1) ? 0.4 : (gaps == 2) ? 0.8 : 1; previousTopRankIndex = ranks[i].index; } return ranks.length - gapPenalty; }
Update added missing semi-colon
Good find, thanks! Fixed in #18 and will be in the next release.
In the _estimatedTricksForSpades function of the spades_ai.dart file it appears that the calculated bid is too low at times.
I believe that adding the line
previousTopRankIndex = ranks[i].index
to the end of the numRanksToCheck loop fixes the issue:Update added missing semi-colon