Skip to content

Commit 8d837a0

Browse files
committed
fix some bugs related to trash pushes and trash finesses
1 parent 21cbe52 commit 8d837a0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/conventions/h-group/action-helper.js

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { isTrash } from '../../basics/hanabi-util.js';
22
import { connectable_simple } from '../../basics/helper.js';
33
import { unknown_1 } from './hanabi-logic.js';
44
import * as Utils from '../../tools/util.js';
5+
import { CLUE_INTERP } from './h-constants.js';
56

67
import logger from '../../tools/logger.js';
78
import { logClue } from '../../tools/log.js';
@@ -25,6 +26,8 @@ import { logClue } from '../../tools/log.js';
2526
*/
2627
export function find_clue_value(clue_result) {
2728
const { finesses, new_touched, playables, bad_touch, trash, cm_dupe, avoidable_dupe, elim, remainder } = clue_result;
29+
if (clue_result.interp === CLUE_INTERP.TRASH_PUSH)
30+
return 1; // trash pushes always meet MCVP because it gets a new card.
2831
const good_new_touched = new_touched.filter(c => !trash.includes(c.order));
2932

3033
// Touching 1 card is much better than touching none, but touching more cards is only marginally better

src/conventions/h-group/clue-interpretation/interpret-clue.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1121,10 +1121,10 @@ function interpret_trash_push(game, action, focus_order) {
11211121
if (clue.type === CLUE.RANK) {
11221122
const promised_ids = Utils.range(0, state.variant.suits.length).map(suitIndex => ({ suitIndex, rank: clue.value }));
11231123

1124-
if (focus_thoughts.possible.intersect(promised_ids).some(i => !isTrash(state, mod_common, i, focus_order, { infer: true })))
1124+
if (focus_thoughts.inferred.intersect(promised_ids).some(i => !isTrash(state, mod_common, i, focus_order, { infer: true })))
11251125
return -1;
11261126
}
1127-
else if (focus_thoughts.possible.some(c => !isTrash(state, mod_common, c, focus_order, { infer: true })) ||
1127+
else if (focus_thoughts.inferred.some(c => !isTrash(state, mod_common, c, focus_order, { infer: true })) ||
11281128
focus_thoughts.inferred.every(i => state.isPlayable(i) && !isTrash(state, mod_common, i, focus_order, { infer: true }))) {
11291129
return -1;
11301130
}

0 commit comments

Comments
 (0)