Bridge Calculator C API
C API for Bridge Calculator double dummy solver by Piotr Beling
|
00001 #ifndef __BELING__BCALC_BRIDGE_SOLVER__ 00002 #define __BELING__BCALC_BRIDGE_SOLVER__ 00003 00053 #ifdef __cplusplus 00054 extern "C" { 00055 #endif 00056 00064 #define BCALC_VERSION 12070 00065 00074 typedef struct BCalcDDS BCalcDDS; 00075 00076 #define BCALC_PLAYER_NORTH 0 ///<North player 00077 #define BCALC_PLAYER_EAST 1 ///<East player 00078 #define BCALC_PLAYER_SOUTH 2 ///<South player 00079 #define BCALC_PLAYER_WEST 3 ///<West player 00080 00086 #define bcalc_playerSymbol(player) ("NESW"[player]) 00087 00093 #define bcalc_declarerToLeader(declarer) (((declarer)+3)%4) 00094 00101 #define bcalc_nextHand(hand, delta) (((hand)+(delta)+4)%4) 00102 00103 #define BCALC_SUIT_CLUBS 0 ///<Club suit number 00104 #define BCALC_SUIT_DIAMONDS 1 ///<Diamond suit number 00105 #define BCALC_SUIT_HEARTS 2 ///<Hearts suit number 00106 #define BCALC_SUIT_SPADES 3 ///<Spades suit number 00107 00108 #define BCALC_NT 4 ///<No trump 00109 00115 #define bcalc_suitSymbol(suit) ("CDHSN"[suit]) 00116 00122 unsigned bcalc_runtimeVersion(); 00123 00142 extern BCalcDDS* bcalcDDS_new(const char* format, const char* hands, int trump, int leader); 00143 00148 extern void bcalcDDS_delete(BCalcDDS* solver); 00149 00155 extern const char* bcalcDDS_getLastError(BCalcDDS* solver); 00156 00161 extern void bcalcDDS_clearError(BCalcDDS* solver); 00162 00175 extern void bcalcDDS_exec(BCalcDDS* solver, const char* cmds); 00176 00182 extern int bcalcDDS_getTricksToTake(BCalcDDS* solver); 00183 00189 extern int bcalcDDS_getTrump(BCalcDDS* solver); 00190 00196 extern void bcalcDDS_setTrumpAndReset(BCalcDDS* solver, int new_trump); 00197 00207 extern void bcalcDDS_setPlayerOnLeadAndReset(BCalcDDS* solver, int new_leader); 00208 00215 extern int* bcalcDDS_getTricksTaken(BCalcDDS* solver, int* result); 00216 00222 extern int bcalcDDS_getCardsLeftCount(BCalcDDS* solver); 00223 00233 extern char* bcalcDDS_getCards(BCalcDDS* solver, char* result, int player, int suit); 00234 00240 extern int bcalcDDS_getPlayerToPlay(BCalcDDS* solver); 00241 00250 extern char* bcalcDDS_getCardsToPlay(BCalcDDS* solver, char* result, int suit); 00251 00263 extern int bcalcDDS_getPlayedCard(BCalcDDS* solver, unsigned whenIndex, int* suit, char* cardSymbol); 00264 00270 extern int bcalcDDS_getPlayedCardsCount(BCalcDDS* solver); 00271 00272 #ifdef __cplusplus 00273 } 00274 #endif 00275 00276 #endif //__BELING__BCALC_BRIDGE_SOLVER__