1 #ifndef __BELING__BCALC_BRIDGE_SOLVER__
2 #define __BELING__BCALC_BRIDGE_SOLVER__
71 #define BCALC_VERSION 14020
83 #define BCALC_PLAYER_NORTH 0
84 #define BCALC_PLAYER_EAST 1
85 #define BCALC_PLAYER_SOUTH 2
86 #define BCALC_PLAYER_WEST 3
93 #define bcalc_playerSymbol(player) ("NESW"[player])
101 #define bcalc_nextHand(hand, delta) (((hand)+(delta))&3) //or (((hand)+(delta))%4)
108 #define bcalc_declarerToLeader(declarer) bcalc_nextHand(declarer, 3)
110 #define BCALC_SUIT_CLUBS 0
111 #define BCALC_SUIT_DIAMONDS 1
112 #define BCALC_SUIT_HEARTS 2
113 #define BCALC_SUIT_SPADES 3
122 #define bcalc_suitSymbol(suit) ("CDHSN"[suit])
307 #endif //__BELING__BCALC_BRIDGE_SOLVER__
void bcalcDDS_exec(BCalcDDS *solver, const char *cmds)
Execute commands which can modify the state of given solver (current situation in game represented by...
unsigned bcalc_runtimeVersion()
Get the version of the API used by the runtime library.
int bcalcDDS_getCardsLeftCount(BCalcDDS *solver)
Get number of cards which left to play in game connected with solver.
int bcalcDDS_getTricksToTakeEx(BCalcDDS *solver, int tricks_target, const char *card)
If tricks_target == -1, calculate number of tricks possible to take.
int bcalcDDS_getPlayedCardsCount(BCalcDDS *solver)
Get number of cards which have been already played.
int bcalcDDS_getTrump(BCalcDDS *solver)
Get strain.
BCalcDDS * bcalcDDS_new(const char *format, const char *hands, int strain, int leader)
Construct new solver.
void bcalcDDS_delete(BCalcDDS *solver)
Delete double dummy solver, free its memory.
BCalcDDS * bcalcDDS_clone(BCalcDDS *to_clone)
Clone the state of the solver to_clone.
int bcalcDDS_getPlayerToPlay(BCalcDDS *solver)
Get player which should play now.
void bcalcDDS_setPlayerOnLeadAndReset(BCalcDDS *solver, int new_leader)
Reset deal to initial state (undo all tricks) and change player on lead.
struct BCalcDDS BCalcDDS
Handler to bcalc double dummy solver.
Definition: bcalcdds.h:81
char * bcalcDDS_getCardsToPlay(BCalcDDS *solver, char *result, int suit)
Get cards possible to play in given suit by player who should play.
char * bcalcDDS_getCards(BCalcDDS *solver, char *result, int player, int suit)
Get cards owned by given player in given suit.
void bcalcDDS_clearError(BCalcDDS *solver)
Clear error message.
int bcalcDDS_getTricksToTake(BCalcDDS *solver)
Calculate number of tricks possible to take (same as bcalcDDS_getTricksToTakeEx(solver, -1, 0)).
const char * bcalcDDS_getLastError(const BCalcDDS *solver)
Get last error string.
void bcalcDDS_setTrumpAndReset(BCalcDDS *solver, int new_trump)
Set new strain and reset deal to initial state (undo all tricks).
int bcalcDDS_getPlayedCard(BCalcDDS *solver, unsigned whenIndex, int *suit, char *cardSymbol)
Get card played as a whenIndex (when card played on first lead has index 0).
int * bcalcDDS_getTricksTaken(BCalcDDS *solver, int *result)
Get numbers of tricks which have been already taken by players in game connected with solver...