Deal 3.1 - GIB interfaces

If you add the line:

source lib/gib.tcl

it will include the GIB interface library.

This code only works on Windows.

gib::directory

This command tells Deal where GIB is installed. If GIB is installed in the standard Windows directory, C:\Program Files\GIB, then you don't need to call this. But if it is installed elsewhere, you need to call this procedure:
source lib/gib.tcl

gib::directory "c:/Games/GIB"
Note that Tcl uses forward-slash characters, / to seperate directory patchs.

You can also just edit gib.tcl to permanently change the default.

Another thing you might want to change is where the gib library places temporary files. Currently, gib.tcl has the directory C:\temp hard-coded for the temporary files. If you don't have such a directory, and don't want to create one, then you'll need to edit gib.tcl .

deal:tricks

Note: In past releases, you would use the gib::tricks command, but that is obsolete in Deal 3.1.

By default, deal::tricks uses the built-in double dummy solver written by Bo Haglund. But when you include lib/gib.tcl, deal::tricks changes to call GIB's double dummy solver.

The procedure deal::tricks returns the number of tricks a hand can make in a specific denomination (suit or notrump.) For example:

source lib/gib.tcl

main {

  accept if {[deal::tricks south notrump]>=12}

}
finds deals where south can make 12 or more tricks in notrump, double-dummy.

This is going to be slow - each call to deal::tricks can take over a second - so you might try to put some additional conditions:

source lib/gib.tcl

main {

  reject if {[hcp north]+[hcp south]<26}

  accept if {[deal::tricks south notrump]>=12}

}
That might miss the occasional freakish slam, but it will be considerably faster.

The deal::tricks procedure caches values, so that multiple calls with the same parameters on the same deal result in quick turn-around.

This is useful if we are using the parscore in our query, or if we use the output format, gibpar, discussed later.

parscore

This routine determines the double-dummy par score for a deal. Because it calls deal::tricks 20 times - once for each declarer and denomination - it can take 20 seconds or more per deal. Not good for huge batches.

Parscore takes as input the dealer and vulnerability:

set result [parscore north NS]
set contract [lindex $result 0]
set declarer [lindex $result 1]
set score    [lindex $result 2]
set tricks   [lindex $result 3]
set auction  [lindex $result 4]
Vulnerability can be one of None, NS, EW, or All.

The result returned is fairly complex - it consists of a list of elements.

[Why do we need to know the dealer? Suppose north and east are the only ones who can make 1NT, and that no higher contracts make. Then double-dummy par is 1NT by east if east is dealer, while it is 1NT by north if anybody else is dealer.]

The gibpar format

As soon as I got GIB, I wanted to use Deal to generate PBN files for GIB to use in play. It was trickier than I thought - GIB apparently wants a *score* in the PBN file. This was why I created the parscore command above - so that I could write out a PBN file with a score which was objective, rather than random.

This format is used like any other format:

C:\Deal30> deal -i format/gibpar 36 > myfile.pbn
As with any other Deal format, format/gibpar can be used with filters:
C:\Deal30> deal -i format/gibpar -i ex/1.tcl > myfile.pbn
Once you've generated this PBN file, you can load it into GIB via the "Load Saved Deal" command.

Competing against double-dummy par is grueling work - it's essentially playing a team game where everybody at the other table is an infallible psychic - both your "opponents" and your teammates. That means that any swings are due to errors at your table and/or luck. They will always bid that making 15% grand at the other table, for example.


Silhouette Thomas Andrews (thomaso@best.com) Copyright 1996-2008. Deal is covered by the GNU General Public License.

Plane Dealing graphic above created using POV-Ray.