Skip to content

Commit f99b8e9

Browse files
authoredJun 25, 2024··
Don't allow deferring bluffs. (#310)
Bluffs should rarely be deferred. Without implementing the necessary checks for when it might be safe to do so we should disallow it.
1 parent e1309ca commit f99b8e9

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed
 

‎src/conventions/h-group/update-turn.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,12 @@ function resolve_card_retained(game, waiting_connection) {
134134
}
135135

136136
if (game.level >= LEVEL.INTERMEDIATE_FINESSES && type === 'finesse' && last_reacting_action.important) {
137-
logger.warn(`allowing ${state.playerNames[reacting]} to defer a finesse for an important clue`);
138-
return { remove: false };
137+
if (bluff) {
138+
logger.warn(`${state.playerNames[reacting]} not allowed to defer a potential bluff`);
139+
} else {
140+
logger.warn(`allowing ${state.playerNames[reacting]} to defer a finesse for an important clue`);
141+
return { remove: false };
142+
}
139143
}
140144
}
141145

‎test/h-group/level-11.js

+40
Original file line numberDiff line numberDiff line change
@@ -810,3 +810,43 @@ describe('bluff clues', () => {
810810
ExAsserts.cardHasInferences(slot1, ['p1']);
811811
});
812812
});
813+
814+
describe('guide principle', () => {
815+
it(`understands a bluff is not deferred by another bluff`, () => {
816+
const game = setup(HGroup, [
817+
['xx', 'xx', 'xx', 'xx'],
818+
['b4', 'p2', 'b5', 'b3'],
819+
['y1', 'g2', 'b5', 'b2'],
820+
['g1', 'y5', 'b1', 'g5']
821+
], {
822+
level: { min: 11 },
823+
starting: PLAYER.BOB
824+
});
825+
takeTurn(game, 'Bob clues red to Alice (slot 2)'); // Could be a bluff
826+
ExAsserts.cardHasInferences(game.common.thoughts[game.state.hands[PLAYER.ALICE][1].order], ['r1', 'r2']);
827+
828+
takeTurn(game, 'Cathy clues purple to Bob'); // Cathy did not play and clued another bluff or finesse.
829+
ExAsserts.cardHasInferences(game.common.thoughts[game.state.hands[PLAYER.ALICE][1].order], ['r1']);
830+
});
831+
832+
it(`understands a bluff is not deferred by a finesse`, () => {
833+
const game = setup(HGroup, [
834+
['xx', 'xx', 'xx', 'xx'],
835+
['b4', 'p2', 'b5', 'b3'],
836+
['y1', 'g2', 'b5', 'b2'],
837+
['p1', 'y5', 'b1', 'g5']
838+
], {
839+
level: { min: 11 },
840+
starting: PLAYER.BOB
841+
});
842+
takeTurn(game, 'Bob clues red to Alice (slot 2)'); // Could be a bluff
843+
ExAsserts.cardHasInferences(game.common.thoughts[game.state.hands[PLAYER.ALICE][1].order], ['r1', 'r2']);
844+
845+
// A bluff can be deferred to perform a finesse per
846+
// https://hanabi.github.io/level-15#a-table-for-deferring-bluffs
847+
// but the circumstances would need to preclude anyone else accidentally playing into it.
848+
// For now, this is not allowed.
849+
takeTurn(game, 'Cathy clues purple to Bob'); // Cathy did not play and clued another bluff or finesse.
850+
ExAsserts.cardHasInferences(game.common.thoughts[game.state.hands[PLAYER.ALICE][1].order], ['r1']);
851+
});
852+
});

0 commit comments

Comments
 (0)
Please sign in to comment.