Bridge Calculator C API
C API for Bridge Calculator double dummy solver by Piotr Beling
Bridge Calculator (C API)

About

This is documentation for C API (and library) for Bridge Calculator engine, a fast double dummy solver.

Bridge Calculator and its C API are develop by Piotr Beling. More information can be found on a program web-page: http://bcalc.w8.pl/

License

Bridge Calculator (and its C API) is freeware for private and non-commercial use (use to develop freeware applications) and it's distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Each distributed product which use this API/library should includes readable for end-user information about this fact and link to Bridge Calculator web-page: http://bcalc.w8.pl/

If you need license to develop commercial (payment) application, please contact with me: qwak82@gmail.com

Example

//create solver
BCalcDDS* solver = bcalcDDS_new("PBN", "N:.63.AKQ987.A9732 A8654.KQ5.T.QJT6 J973.J98742.3.K4 KQT2.AT.J6542.85", BCALC_NT, BCALC_PLAYER_NORTH);
if (solver != 0) exit(1);       //out of memory error
//use it, print player to play, and how many tricks his line can take:
printf("%c playes, and he with partner will be able to take %d tricks.\n",
        bcalc_playerSymbol(bcalcDDS_getPlayerToPlay(solver)),
        bcalcDDS_getTricksToTake(solver)
);
bcalcDDS_exec(solver, "7D x x");        //play 7 of dimamonds, and two smallest diamonds
//print current situation:
printf("%c playes, and he with partner will be able to take %d tricks.\n",
        bcalc_playerSymbol(bcalcDDS_getPlayerToPlay(solver)),
        bcalcDDS_getTricksToTake(solver)
);
bcalcDDS_delete(solver);        //and delete (free memory)

Names

All names defined by library have prefixes:

  • BCALC_ - consts (defines)
  • BCalc - types (for example: BCalcDDS)
  • bcalc - functions and macros
    • bcalcDDS - functions which operates on BCalcDDS (almost all takes BCalcDDS* as first argument)
 All Files Functions Typedefs Defines