Bridge Calculator C API
C API for Bridge Calculator double dummy solver by Piotr Beling
 All Files Functions Typedefs Macros Pages
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: qwak8.nosp@m.2@gm.nosp@m.ail.c.nosp@m.om

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",
);
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",
);
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)

Changes and Backward Compatibility

  • ver. 14020 (5 II 2014):
    • compatibility: API - yes (changes of application source are not required), ABI - yes (recompilation of application is not required),
    • new function bcalcDDS_getTricksToTakeEx, this is extendend version of bcalcDDS_getTricksToTake and takes new, optional arguments: tricks_target and card,
    • new function bcalcDDS_clone,
    • in many places, the ASCII symbols of the suits, strains or players are accepted (as well as BCALC_* constants)