@@ -592,7 +592,6 @@ export function interpret_clue(game, action) {
592
592
return game ;
593
593
}
594
594
}
595
-
596
595
// Check for forward trash finesses or bluffs at level 14
597
596
if ( game . level >= LEVEL . TRASH_PUSH ) {
598
597
// trash finesses are only valid if the clue initially reveals all cards to be playable or trash.
@@ -609,32 +608,30 @@ export function interpret_clue(game, action) {
609
608
inbetween_players . push ( i % game . players . length ) ;
610
609
}
611
610
for ( const p of inbetween_players ) {
612
- if ( p === game . me . playerIndex )
611
+ if ( p === state . ourPlayerIndex )
613
612
continue ;
614
613
const first_unclued = state . hands [ p ] . sort ( ( a , b ) => b - a ) . filter ( c => ! state . deck [ c ] . clued ) [ 0 ] ;
615
- // the leftmost unclued card is either the same color as the clue, or the same rank
616
- if ( ( clue . type === CLUE . COLOUR && state . deck [ first_unclued ] . suitIndex === clue . value ) ||
617
- clue . type === CLUE . RANK && state . deck [ first_unclued ] . rank === clue . value )
614
+ // the leftmost unclued card is either the same color as the clue, or the same rank, and is playable
615
+ if ( ( ( clue . type === CLUE . COLOUR && state . deck [ first_unclued ] . suitIndex === clue . value ) ||
616
+ clue . type === CLUE . RANK && state . deck [ first_unclued ] . rank === clue . value ) && ! state . isBasicTrash ( state . deck [ first_unclued ] ) )
618
617
last_possible_player = p ;
619
618
}
620
619
// if no one else has the card, we have it
621
620
if ( last_possible_player === - 1 ) {
622
- if ( giver === game . me . playerIndex ) {
621
+ if ( giver === state . ourPlayerIndex ) {
623
622
game . interpretMove ( CLUE_INTERP . MISTAKE ) ;
624
623
team_elim ( game ) ;
625
624
return game ;
626
625
}
627
- last_possible_player = game . me . playerIndex ;
626
+ last_possible_player = state . ourPlayerIndex ;
628
627
}
629
- // Mark it as finessed
630
628
const { possible } = common . thoughts [ state . hands [ last_possible_player ] . sort ( ( a , b ) => b - a ) . filter ( c => ! state . deck [ c ] . clued ) [ 0 ] ] ;
631
- const new_inferred = possible . intersect ( possible . filter ( i => state . isBasicTrash ( i ) ) ) ;
629
+ const new_inferred = possible . intersect ( possible . filter ( i => state . isPlayable ( i ) ) ) ;
632
630
common . updateThoughts ( state . hands [ last_possible_player ] . sort ( ( a , b ) => b - a ) . filter ( c => ! state . deck [ c ] . clued ) [ 0 ] ,
633
631
( draft ) => {
634
632
draft . inferred = new_inferred ;
635
633
draft . info_lock = new_inferred ;
636
634
draft . finessed = true ;
637
- draft . possibly_bluffed = true ;
638
635
} ) ;
639
636
for ( const order of list ) {
640
637
if ( ! state . deck [ order ] . newly_clued )
@@ -650,9 +647,9 @@ export function interpret_clue(game, action) {
650
647
} ) ;
651
648
}
652
649
653
- perform_cm ( state , common , tfcm_orders ) ;
650
+ perform_cm ( state , common , tfcm_orders . filter ( x => x != - 1000 ) ) ;
654
651
655
- game . interpretMove ( CLUE_INTERP . CM_TRASH ) ;
652
+ game . interpretMove ( CLUE_INTERP . PLAY ) ;
656
653
team_elim ( game ) ;
657
654
return game ;
658
655
}
@@ -758,7 +755,7 @@ export function interpret_clue(game, action) {
758
755
}
759
756
}
760
757
if ( giver !== game . me . playerIndex )
761
- additional_possibilities . push ( new BasicCard ( state . deck [ order_pushed ] . suitIndex , state . deck [ order_pushed ] . rank ) )
758
+ additional_possibilities . push ( new BasicCard ( state . deck [ order_pushed ] . suitIndex , state . deck [ order_pushed ] . rank ) ) ;
762
759
const new_inferred = possible . intersect ( possible . filter ( i => state . isPlayable ( i ) ||
763
760
additional_possibilities . some ( x => {
764
761
return x . suitIndex === i . suitIndex && x . rank === i . rank ;
@@ -1168,15 +1165,15 @@ function interpret_trash_finesse(game, action, focus_order) {
1168
1165
}
1169
1166
// check if all new cards are actually trash
1170
1167
for ( const order of list ) {
1171
- if ( state . deck [ order ] . newly_clued && ! isTrash ( state , mod_common , state . deck [ order ] . identity , order , { infer : true } ) )
1168
+ if ( state . deck [ order ] . newly_clued && ! state . isBasicTrash ( state . deck [ order ] ) )
1172
1169
return [ ] ;
1173
1170
}
1174
1171
1175
1172
const oldest_trash_index = state . hands [ target ] . findLastIndex ( o => state . deck [ o ] . newly_clued ) ;
1176
1173
1177
1174
logger . info ( `oldest trash card is ${ logCard ( state . deck [ state . hands [ target ] [ oldest_trash_index ] ] ) } ` ) ;
1178
1175
1179
- const cm_orders = [ ] ;
1176
+ const cm_orders = [ - 1000 ] ;
1180
1177
1181
1178
// Chop move every unclued card to the right of this, since trash finesses do that
1182
1179
for ( let i = oldest_trash_index + 1 ; i < state . hands [ target ] . length ; i ++ ) {
@@ -1186,6 +1183,6 @@ function interpret_trash_finesse(game, action, focus_order) {
1186
1183
cm_orders . push ( order ) ;
1187
1184
}
1188
1185
1189
- logger . highlight ( 'cyan' , cm_orders . length === 0 ? 'no cards to tcm' : `trash chop move on ${ cm_orders . map ( o => logCard ( state . deck [ o ] ) ) . join ( ',' ) } ${ cm_orders } ` ) ;
1186
+ logger . highlight ( 'cyan' , cm_orders . length === 0 ? 'no cards to tcm' : `trash chop move on ${ cm_orders . filter ( x => x != - 1000 ) . map ( o => logCard ( state . deck [ o ] ) ) . join ( ',' ) } ${ cm_orders . filter ( x => x != - 1000 ) } ` ) ;
1190
1187
return cm_orders ;
1191
1188
}
0 commit comments