Table Master

The Blue Chip Bridge Table Manager Protocol allows bridge programs to communicate with each other in order to play bridge. ASCII messages (terminated with a CRLF) are exchanged over TCP/IP.

The table-master-parser package parses these messages and produces an Abstract Syntax Tree. Use the online parser to see the results of parsing a message.

bid message


bid := seat call [Alert. /.+/]
seat := north | south | east | west
call := passes | doubles | redoubles | bids /^[1-7]([SHDC]|NT)/

Example

south bids 1NT Alert. 12 to 14 total points

produces the AST

{
    "kind": "bid",
    "alert": "12 to 14 total points",
    "bid": "1NT",
    "seat": "S"
}

cards message


cards := seat' cards : hand
seat' := north's | south's | east's | west's
hand := (someCards)...
someCards := suit scards .
suit := S | H | D | C
scards := - | /^[AKQJT98765432 ]+/

Example

north's cards : S A K J 4 3. H -. D 6 5 4 3. C Q J T 9.

produces the AST

{
    "kind": "cards",
    "cards": [
        "AS",
        "KS",
        "JS",
        "4S",
        "3S",
        "6D",
        "5D",
        "4D",
        "3D",
        "QC",
        "JC",
        "TC",
        "9C"
    ],
    "seat": "N"
}

connect message


connect := connecting teamName as seat using protocol version protocolVersion
teamName := quoted-string
seat := north | south | east | west
protocolVersion := #

Example

connecting "..." as north using protocol version 18

produces the AST

{
    "kind": "connect",
    "protocolVersion": 18,
    "seat": "N",
    "teamName": "..."
}

deal message


deal := board number # . dealer seat . vulnerable
seat := north | south | east | west
vulnerable := Neither vulnerable | N/S vulnerable | E/W vulnerable | Both vulnerable

Example

board number 801 . dealer north . Neither vulnerable

produces the AST

{
    "kind": "deal",
    "vulnerable": "Nil",
    "dealer": "N",
    "board": 801
}

dummyCards message


dummyCards := dummy's cards : hand
hand := (someCards)...
someCards := suit scards .
suit := S | H | D | C
scards := - | /^[AKQJT98765432 ]+/

Example

dummy's cards : S A K J 4 3. H -. D 6 5 4 3. C Q J T 9.

produces the AST

{
    "kind": "dummyCards",
    "cards": [
        "AS",
        "KS",
        "JS",
        "4S",
        "3S",
        "6D",
        "5D",
        "4D",
        "3D",
        "QC",
        "JC",
        "TC",
        "9C"
    ]
}

dummyLead message


dummyLead := dummy to lead

Example

dummy to lead

produces the AST

{
    "kind": "dummyLead"
}

endOfBoard message


endOfBoard := timing - N/S : this board mmss , total hhmmss . E/W : this board mmss , total hhmmss
mmss := /^\d+\:\d+/
hhmmss := /^\d+\:\d+\:\d+/

Example

timing - N/S : this board 3:30 , total 1:10:30 . E/W : this board 3:30 , total 1:10:30

produces the AST

{
    "kind": "endOfBoard",
    "ewTotalTime": "1:10:30",
    "ewBoardTime": "3:30",
    "nsTotalTime": "1:10:30",
    "nsBoardTime": "3:30"
}

endOfSession message


endOfSession := end of session

Example

end of session

produces the AST

{
    "kind": "endOfSession"
}

illegalBid message


illegalBid := illegal bid

Example

illegal bid

produces the AST

{
    "kind": "illegalBid"
}

lead message


lead := seat to lead
seat := north | south | east | west

Example

south to lead

produces the AST

{
    "kind": "lead",
    "seat": "S"
}

play message


play := seat plays card
seat := north | south | east | west
card := /^[AKQJT98765432][SHDC]/

Example

north plays KH

produces the AST

{
    "kind": "play",
    "card": "KH",
    "seat": "N"
}

readyForBid message


readyForBid := seat ready for seat' bid
seat := north | south | east | west
seat' := north's | south's | east's | west's

Example

north ready for north's bid

produces the AST

{
    "kind": "readyForBid",
    "from": "N",
    "seat": "N"
}

readyForCard message


readyForCard := seat ready for seat' card to trick trickNumber
seat := north | south | east | west
seat' := north's | south's | east's | west's
trickNumber := #

Example

south ready for east's card to trick 548

produces the AST

{
    "kind": "readyForCard",
    "trick": 548,
    "player": "E",
    "seat": "S"
}

readyForCards message


readyForCards := seat ready for cards
seat := north | south | east | west

Example

north ready for cards

produces the AST

{
    "kind": "readyForCards",
    "seat": "N"
}

readyForDeal message


readyForDeal := seat ready for deal
seat := north | south | east | west

Example

west ready for deal

produces the AST

{
    "kind": "readyForDeal",
    "seat": "W"
}

readyForDummy message


readyForDummy := seat ready for dummy
seat := north | south | east | west

Example

west ready for dummy

produces the AST

{
    "kind": "readyForDummy",
    "seat": "W"
}

readyForTeams message


readyForTeams := seat ready for teams
seat := north | south | east | west

Example

east ready for teams

produces the AST

{
    "kind": "readyForTeams",
    "seat": "E"
}

readyToStart message


readyToStart := seat to start
seat := north | south | east | west

Example

west to start

produces the AST

{
    "kind": "readyToStart",
    "seat": "W"
}

seated message


seated := seat teamName seated
seat := north | south | east | west
teamName := quoted-string

Example

north "..." seated

produces the AST

{
    "kind": "seated",
    "teamName": "...",
    "seat": "N"
}

startOfBoard message


startOfBoard := start of board

Example

start of board

produces the AST

{
    "kind": "startOfBoard"
}

teams message


teams := teams : N/S : teamName E/W : teamName
teamName := quoted-string

Example

teams : N/S : "..." E/W : "..."

produces the AST

{
    "kind": "teams",
    "EW": "...",
    "NS": "..."
}