@@ -778,51 +778,53 @@ export function interpret_clue(game, action) {
778
778
for ( let i = ( giver + 1 ) ; i < target + game . players . length ; i ++ )
779
779
inbetween_players . push ( i % game . players . length ) ;
780
780
}
781
- for ( const p of inbetween_players ) {
782
- if ( p === state . ourPlayerIndex )
783
- continue ;
784
- const first_unclued = state . hands [ p ] . sort ( ( a , b ) => b - a ) . filter ( c => ! state . deck [ c ] . clued ) [ 0 ] ;
785
- // the leftmost unclued card is either the same color as the clue, or the same rank, and is playable
786
- if ( ( ( clue . type === CLUE . COLOUR && state . deck [ first_unclued ] . suitIndex === clue . value ) ||
787
- clue . type === CLUE . RANK && state . deck [ first_unclued ] . rank === clue . value ) && ! state . isBasicTrash ( state . deck [ first_unclued ] ) )
788
- last_possible_player = p ;
789
- }
790
- // if no one else has the card, we have it
791
- if ( last_possible_player === - 1 ) {
792
- if ( giver === state . ourPlayerIndex ) {
793
- game . interpretMove ( CLUE_INTERP . MISTAKE ) ;
794
- team_elim ( game ) ;
795
- return game ;
781
+ if ( inbetween_players . length > 0 ) {
782
+ for ( const p of inbetween_players ) {
783
+ if ( p === state . ourPlayerIndex )
784
+ continue ;
785
+ const first_unclued = state . hands [ p ] . sort ( ( a , b ) => b - a ) . filter ( c => ! state . deck [ c ] . clued ) [ 0 ] ;
786
+ // the leftmost unclued card is either the same color as the clue, or the same rank, and is playable
787
+ if ( ( ( clue . type === CLUE . COLOUR && state . deck [ first_unclued ] . suitIndex === clue . value ) ||
788
+ clue . type === CLUE . RANK && state . deck [ first_unclued ] . rank === clue . value ) && ! state . isBasicTrash ( state . deck [ first_unclued ] ) )
789
+ last_possible_player = p ;
796
790
}
797
- last_possible_player = state . ourPlayerIndex ;
798
- }
799
- const { possible } = common . thoughts [ state . hands [ last_possible_player ] . sort ( ( a , b ) => b - a ) . filter ( c => ! state . deck [ c ] . clued ) [ 0 ] ] ;
800
- const new_inferred = possible . intersect ( possible . filter ( i => state . isPlayable ( i ) ) ) ;
801
- common . updateThoughts ( state . hands [ last_possible_player ] . sort ( ( a , b ) => b - a ) . filter ( c => ! state . deck [ c ] . clued ) [ 0 ] ,
802
- ( draft ) => {
803
- draft . inferred = new_inferred ;
804
- draft . info_lock = new_inferred ;
805
- draft . finessed = true ;
806
- } ) ;
807
- for ( const order of list ) {
808
- if ( ! state . deck [ order ] . newly_clued )
809
- continue ;
791
+ // if no one else has the card, we have it
792
+ if ( last_possible_player === - 1 ) {
793
+ if ( giver === state . ourPlayerIndex ) {
794
+ game . interpretMove ( CLUE_INTERP . MISTAKE ) ;
795
+ team_elim ( game ) ;
796
+ return game ;
797
+ }
798
+ last_possible_player = state . ourPlayerIndex ;
799
+ }
800
+ const { possible } = common . thoughts [ state . hands [ last_possible_player ] . sort ( ( a , b ) => b - a ) . filter ( c => ! state . deck [ c ] . clued ) [ 0 ] ] ;
801
+ const new_inferred = possible . intersect ( possible . filter ( i => state . isPlayable ( i ) ) ) ;
802
+ common . updateThoughts ( state . hands [ last_possible_player ] . sort ( ( a , b ) => b - a ) . filter ( c => ! state . deck [ c ] . clued ) [ 0 ] ,
803
+ ( draft ) => {
804
+ draft . inferred = new_inferred ;
805
+ draft . info_lock = new_inferred ;
806
+ draft . finessed = true ;
807
+ } ) ;
808
+ for ( const order of list ) {
809
+ if ( ! state . deck [ order ] . newly_clued )
810
+ continue ;
810
811
811
- const { possible } = common . thoughts [ order ] ;
812
- const new_inferred = possible . intersect ( possible . filter ( i => state . isBasicTrash ( i ) ) ) ;
812
+ const { possible } = common . thoughts [ order ] ;
813
+ const new_inferred = possible . intersect ( possible . filter ( i => state . isBasicTrash ( i ) ) ) ;
813
814
814
- common . updateThoughts ( order , ( draft ) => {
815
- draft . inferred = new_inferred ;
816
- draft . info_lock = new_inferred ;
817
- draft . trash = true ;
818
- } ) ;
819
- }
815
+ common . updateThoughts ( order , ( draft ) => {
816
+ draft . inferred = new_inferred ;
817
+ draft . info_lock = new_inferred ;
818
+ draft . trash = true ;
819
+ } ) ;
820
+ }
820
821
821
- perform_cm ( state , common , tfcm_orders . filter ( x => x != - 1000 ) ) ;
822
+ perform_cm ( state , common , tfcm_orders . filter ( x => x != - 1000 ) ) ;
822
823
823
- game . interpretMove ( CLUE_INTERP . PLAY ) ;
824
- team_elim ( game ) ;
825
- return game ;
824
+ game . interpretMove ( CLUE_INTERP . PLAY ) ;
825
+ team_elim ( game ) ;
826
+ return game ;
827
+ }
826
828
}
827
829
}
828
830
const focus_possible = find_focus_possible ( game , action , focusResult , thinks_stall ) ;
0 commit comments