mwg API
    Preparing search index...

    Function drawSolitaire

    • Draws from the stock to the waste; once the stock is empty, the waste is turned back over into a new stock rather than the game being stuck.

      Parameters

      Returns Card | null

      import { dealSolitaire, drawSolitaire } from '@datamoc/mw_games/board';

      const state = dealSolitaire(1);
      const card = drawSolitaire(state);
      console.log(card); // { suit: 'hearts', rank: 7 }
      console.log(state.waste.length, state.stock.length); // 1 23