mwg API
    Preparing search index...

    Function trickWinner

    • Highest card of the trump suit wins; failing that, highest card of whoever led. Ace (rank 1) ranks lowest, as in belote/tarot/bridge follow-suit play.

      Type Parameters

      • O = string

      Parameters

      Returns O

      import { trickWinner } from '@datamoc/mw_games/board';

      const plays = [
      { owner: 'north', card: { suit: 'hearts' as const, rank: 5 as const } },
      { owner: 'south', card: { suit: 'hearts' as const, rank: 10 as const } },
      { owner: 'east', card: { suit: 'spades' as const, rank: 13 as const } },
      ];

      console.log(trickWinner(plays)); // 'south' - highest heart, hearts led
      console.log(trickWinner(plays, 'spades')); // 'east' - the only spade played beats every heart