Next: , Previous: , Up: Programming with libtarot   [Contents][Index]


4.6 The card counter

struct: TarotCounter

In order to provide high-level features for machine learning, we use a card counter, which is a device that keeps track of who can have what cards. Because it requires extra memory and computing, it is not part of the ‘TarotGame’ API.

Function: void tarot_counter_copy (TarotCounter *dest, const TarotCounter *source)

Copy source to dest.

Function: size_t tarot_counter_n_cards_remaining (const TarotCounter *counter, TarotPlayer player)
Function: size_t tarot_counter_n_cards_doscard (const TarotCounter *counter)

Query how many cards are in player’s hand or in the dog / discard.

Function: int tarot_counter_may_own (const TarotCounter *counter, size_t n, const TarotPlayer *owners, TarotCard card)
Function: int tarot_counter_may_be_in_doscard (const TarotCounter *counter, TarotCard card)

Return whether any of the n owners (or the dog or discard for ‘tarot_counter_may_be_in_doscard’) may own card.

Function: void tarot_counter_load_from_game (TarotCounter *counter, const TarotGame *game)

Process all information of game and store it in counter.

enum: TarotImputationError

An enumeration for the status of the ‘tarot_counter_and_game_impute’ function. It is either:

  1. TAROT_IMPUTATION_OK’ = 0 if the imputation succeeded;
  2. TAROT_IMPUTATION_FAILED’ = 1 otherwise.
Function: TarotImputationError tarot_counter_and_game_impute (const TarotCounter *counter, TarotGame *game, size_t n, const void *seed)

Try to infer the cards of all players and those of the dog by using the information in counter. After this function call, either the operation succeeded and now game knows all the cards of everyone (and counter is updated to keep in sync), or the function fails.

This operation uses the n bytes of seed to initialize the pseudo-random number generator.


Next: , Previous: , Up: Programming with libtarot   [Contents][Index]