Factored out greedy check

This commit is contained in:
2021-07-08 21:30:30 +02:00
parent fa6e0806f1
commit 1c22d47840
+4 -5
View File
@@ -474,13 +474,12 @@ function recommendThrowaway(depth = 0, thisHand = null, thisDeck = null, chance
for (let choice of choices) { for (let choice of choices) {
let result = getHandPoints(hands[choice.index]); let result = getHandPoints(hands[choice.index]);
if (!greedyAlgorithm) {
result.points = cashOut(hands[choice.index], result, false);
}
if (result.points > 0) { if (result.points > 0) {
if (greedyAlgorithm) {
choice.points = result.points; choice.points = result.points;
}
else {
choice.points = cashOut(hands[choice.index], result, false);
}
choice.pattern = result.pattern; choice.pattern = result.pattern;
choice.cards = result.cards; choice.cards = result.cards;