Musings on Duplicate Bridge

Bridge Game Reporter for Duplicate Bridge

Posted 10 March 2018


Some time ago I created Bridge Game Reporter (BGR), a wrapper for Ray Spalding’s wonderful Bridge Composer (BC) program, for the Columbus Bridge Center, our local bridge club.  Bridge Composer produces really nifty HTML and PDF reports of duplicate bridge games, but using it can become tedious, and non-technically-oriented bridge directors are prone to making mistakes when FTP’ing result files to a website.  So, my BGR program automates all that stuff and makes calls into the BC API to make the magic happen.  After the inevitable problems and issues, it seemed to be working fine at the CBC, and then Siraj Haji, owner/operator of the Aloha Bridge Club asked me if I would mind sharing the program with him.  Siraj had a slightly different setup, and rather than FTP’ing result files to a website, he wanted to email them to just those players who actually played in a particular game, so he and I worked out the strategy for using ACBL player numbers from session reports as a search key into a CSV-formatted email list.  After the usual number of mistakes, we got it working.  A few days later Siraj mentioned that he also uses Bridge Composer to generate game files for upcoming games, but it was somewhat tedious – could I maybe use my new-found BC superpowers to do something about that?  Well, it turns out that the BC guy (Ray Spalding) created a pretty nice API to BC, and provided a WScript/JScript example that did most of what we wanted.  After a few days of fumbling around, I figured out most of what was going on behind the curtains, and realized that I could fairly easily add a ‘game generation tool’ to my BGR app to add bulk game generation capabilities.  Again after the normal number of mistakes, Siraj reported that this feature seemed to be working – yay!

At some point in this process, after the email feature was added and before the bulk game generation feature, I got another request for the program from another club in the area, so I realized I was going to have to provide an actual installation program and some user documentation.  Since I already had this blog site, I decided to use it as the documentation vehicle.


Bridge Game Reporter Features:

  • Uses Ray Spalding’s Bridge Composer program, which must be installed and active for the magic to work.
  • Automates the process of calling Bridge Composer with the correct set of files for a particular game.
  • Optionally automates the process of FTPing Bridge Composer game summary and hand records to a selected website
  • Optionally automates the process of emailing results to a user-supplied list of email recipients
  • Automates the process of generating multiple games over a range of dates/times using the ‘Game Generation’ tool.

Main Page:

The main page of the Bridge Game Reporter program is shown below, along with a description of each control area.

Bridge Game Reporter main page

Game Date: The user selects the desired game date from a drop-down calendar display.  This date is used to construct the filename to be searched for. The file name format is in the form [yymmdd][session time].ext, where yy = year, mm = month, dd = day, session time = ‘M’ (Morning), ‘A’ (Afternoon), ‘E’ (Evening), or ‘L’ (Late).  All input files associated with a particular game will have this format.  For instance, for an afternoon game on March 6, 2018, the filename will be 180306A.ext, where ‘ext’ = BRI (or DUP or PBN) for the deal file, BWS for the Bridgemate results file, TXT for the text summary file, HTML for the report output from Bridge Composer, and LOG for the log file optionally created by BGR.

Game Time: The user selects one of ‘Morning’, ‘Afternoon’, ‘Evening’, or ‘Late’.  This selection is used to form the ‘MAEL’ suffix to the filename.

Lock Entry Fields: For a particular club setup, most of the fields dealing with file locations can be set once and then never changed again.  To prevent inadvertent changes to these fields, this option, when checked, will make them all read-only.

Game Input Folders: The location for the .BRI, .DUP, or .PBN game files, the .TXT summary file, and the .BWS Bridgemate score files.  The .BWS file can be skipped, if necessary.

Game Report Folders: The location for the .HTML and the optional .LOG files.  This section also contains the ‘FTP to Website’ checkbox and the the URL for the destination website, if this feature is enabled, and the ‘Email to List’ checkbox and corresponding location for the email list document.

Start, Close buttons and logging area: The ‘Start’ button will remain grayed-out until all required input conditions are met, at which time it will become click-able.  Clicking ‘Start’ will cause the program to assemble all the required information and send it to Bridge Composer for processing; then it will optionally transmit the results to either a selected website or to addresses on an email list.  The ‘Close’ button will close the program.  The logging area displays progress and/or error information. If the ‘Save log to folder’ option is checked, then the log file will be saved to [yymmdd][session].LOG in the selected folder.

Set FTP/Email Creds: FTP and/or email server login information (username & password) is saved in the ‘BGR.TXT’ file, which must be in the C:\BGR\ folder (this folder and a default file are automatically created at installation).  The format of the BGR.TXT file is


Clicking the Set FTP/Email Creds button will bring up the following dialog box for editing the contents of BGR.TXT.  This dialog is password protected, more to prevent inadvertent changes by untrained personnel than for any serious security.

Reset Folders to Defaults: Clicking this button will overwrite the current folder settings with the last-saved set of default settings.  This button (and the corresponding ‘Save Current Settings as Defaults’) are almost never used, as the program automatically saves the last set of user settings whenever the program is closed, and automatically restores them the next time the program is launched.


Emailing Results:

The email feature requires four components:

  • The session summary ([date][session].TXT) file produced by ACBLSCOR containing player names and ACBL player numbers
  • A user-provided file containing email addresses in CSV format (an example is provided)
  • A user-customized ‘EmailTemplate.txt’ email template file  (an example is provided) containing the body of the email to be sent
  • Any HTML/PDF attachments to be sent.  All desired attachments must have the same filename as all the game files for the particular session, with a .HTML or .PDF extension, and must be in the same folder.

The email list must be in CSV format, and must be formatted as follows:

Name,ACBL #,Email Address,Opt out
Jody Lastname,R892974,,
Daniel Lastname,N184169,,yes

A ‘yes’ (case-insensitive) in the ‘Opt out’ field will cause that address to be skipped.

The ‘EmailTemplate.TXT’ file format is:

Aloha Bridge Club results for [GAMEDATE] – [SESSION]

Thank you for playing. This automated email is intended solely for players in this specific session. Thank you for your support and cooperation.

In the above example, the FROM:, SUBJECT:, and BODY: sections are required fields, and must be placed as shown.  [GAMEDATE] and [SESSION] are optional fields that will be replaced by the actual game date and the actual session time (‘Morning’, ‘Afternoon’, etc).  The resulting email using the above template looks like the following, where ‘[GAMEDATE] – [SESSION]’ was replaced by ‘February 26, 2018 – Evening’

Game Generation Tool:

The game generation tool is intended to automate the process of batch-producing dealer (.PBN or .BRI) files for games over a range of dates and session times. if, for instance, you wished to produce the deal files for all Monday, Wednesday, and Friday afternoon and evening games for the entire month of April you could simply set up the dates and times, and press one button to generate all the game files.

The game generator tool is accessed from the main Bridge Game Reporter page by selecting the ‘Game Generator’ item under the ‘Tools’ menu.  The tool dialog is shown below, along with an explanation of each control section.


Start/End Date: The starting and ending dates for game generation (inclusive)

Game Times: Select one or more game time checkboxes to have that session time’s game generated for every applicable date.  Checking ‘All’ will enable all times, and unchecking ‘All’ will disable all times.

Game Days: Select one or more game day checkboxes to have games generated for all enabled session times for all those days of the week within the selected date range, inclusive.  Checking ‘All’ will enable all days, and unchecking ‘All’ will disable all days.

Selection Summary: This is a read-only running summary of the number of days, times, and total games to be generated.  It’s  a good idea to check that the ‘Tot Games’ number is what you expect, before starting the generation run.

Destination Folder: The folder to be used as the destination for generated game files.  This folder must exist, and must contain the template file ‘handrecord.pbn’ (see below)

Output Format: Bridge Composer can create game files in either .PBN or .BRI format – simply select which one is desired.

Number of boards to generate: Type in the desired number of boards to generate per game.  This will typically be 24, 27, or 36, but can be anything.   I suggest setting this to 2 or 3 when first getting used to the program.

Generate Games: Starts the generation process.  Note that this button won’t be enabled (click-able) until all the prerequisites are met (start/end date, days of week, session times, destination folder, etc).  If the button won’t enable, check the log for helpful messages.

handrecord.pbn template file: This is a required file, and it must be present in the folder selected in the ‘Destination Folder’ entry field.  This template file is used by Bridge Composer to customize hand record output for your club or organization, as shown below:

2-board game generated using the default ‘handrecord.pbn’ file

The above figure shows a 2-board game generated by Bridge Composer using the default ‘handrecord.pbn’ file.  The text in the title area above can be customized for your own club using Bridge Composer’s ‘Format Title Area’ menu as shown below

Once the required customizations have been accomplished, simply save the result back to ‘handrecord.pbn’, and they will show up the next time a game is generated.  Note that Bridge Composer supports many other customizations to the ‘handrecord.pbn’ template, but that’s an exercise that is left up to the user ;-).


Download and launch BridgeGameReporter.msi to install Bridge Game Reporter on your (Windows only – not MAC) PC.  The installation program will do the following:

  • Install the BGR application in C:\ProgramFiles(x86)\Bridge Game Reporter
  • Create the folder C:\BGR\ and place a default BGR.TXT file there for ftp/email credentials
  • Create another BridgeGameReporter folder in your ‘My Documents’ folder to hold the ‘handrecord.pbn’ file required for game generation, and the ‘EmailAddressList_Sample.csv’ and ‘EmailTemplate_Sample.txt’ sample files.
  • Place a red heart-shaped ‘BGR’ icon on your desktop

Once the installation completes, launch the program using the desktop icon, and fill in fields as required/desired.  Note that if you want to use the game generation tool, you should set the Destination Folder field to the ‘BridgeGameReporter’ folder in your ‘My Documents’ folder.



The Duplicate Bridge ‘Blame’ Chip

Posted 6/17/2015.

A favorite topic among duplicate bridge players is just who’s to blame for a particular screw-up.  Bridge is a somewhate unique sport in that it requires two players per side, and both players in a partnership contribute to success or failure.  A really good player can make up for many (but not all) mistakes by a weaker player, but winning partnerships require that both players minimize their mistakes. Most established (and all successful) partnerships have developed a way of handling the blame issue in a way that doesn’t degrade or destroy the partnership.  One pair that I know describes this process as ‘blame management’.  The idea, so they say (somewhat tongue-in-cheek) is to bid in a way that ensures that any blame for mistakes will fall on one’s partner rather than oneself.  This incentivizes each partner to bid as correctly as possible given the partnership agreement (their convention card) and the particular circumstances at the time.  Having ‘a bright idea’ and ‘going off piste’ might work, but if it doesn’t the blame will fall squarely on the errant partner (and even if it does work, it might incur significant blame for not adhering strictly to the partnership agreement).

I liked this idea of ‘blame management’ so much that I have tried to incorporate it into my own partnerships; I try to get the idea of blame management out in the open early on, so my partner is (hopefully) comfortable with the idea of assigning blame in an open and humorous way, rather than letting issues fester.  Lately I have started describing this as ‘moving the blame chip from one side of the table to the other’, and that got me thinking that maybe I could use my engineering and 3D printing capabilities to fabricate an actual, physical ‘Blame Chip’.

I started this project as I do almost all my new projects – researching on the internet with Google.  I found card and pip images, and then I found a set of zip files with 3D models of all the various card elements.  From this I extracted the 4 pips I needed (clubs, hearts, spades, diamonds), and arranged them circularly around the word ‘BLAME’, as shown in the following screenshot.

TinkerCad design for the Duplicate Bridge Blame Chip

TinkerCad design for the Duplicate Bridge Blame Chip

Then I printed it on my MicroCenter 3D Pro 3D printer, using blue and white (the two colors I had on the machine at the time).  Here are some photos of the result.

3D printed version of the 'Duplicate Bridge Blame Chip'.  The chip laying on the pen is actually two chips glued together to form a 2-sided chip.

3D printed version of the ‘Duplicate Bridge Blame Chip’. The chip laying on the pen is actually two chips glued together to form a 2-sided chip.

The items that come off the printer are blank on the reverse side, so to get a real 2-sided ‘poker chip’ style item, I simply printed two chips and glued them together.  In the photo above, the chip leaning on the pen is a 2-sided version, while the others are single-sided.

I’m not really sure where I’m going with this, as the sudden appearance of a real, physical ‘blame’ chip at the table may have unintended (read ‘disastrous’) consequences.  My wife has suggested these might make great bridge party favors, and I may try giving some of these away to established partnerships before I get too ambitious. Also, I will probably try printing some with white pips on a red background to see how they look.



Gatlinburg, Tn NABC Regional, Postscript

April 18, 2015

I’m writing this from home on Saturday, after travelling back from Gatlinburg.  I got up this morning, had a last big breakfast at the Pancake Cabin, was on the road about 8:30 am, and was back here by 3:30 pm.  Got another 4-5 hours of prime book-listening time on ‘Lucifer’s Hammer’, and home in plenty of time to catch up on email and write this post.  I also was treated to another ‘alternate reality’ experience as I left the Gatlinburg area.  When I came off the mountain road back into civilization, (if you can call that strip ‘civilized’), I saw mile after mile of antique cars lining the road on both sides of this big 4-lane highway, with people sitting in lawn chairs on the sidewalk as if they were watching a parade!  Evidently I had stumbled through some sort of regular antique car show/sales event.  I mean, they sometimes have something like this in the parking lot of our local DQ restaurant, but this went on for miles!

Just to round out my partnership desk experiences, my morning session partner never showed, so I was left with nothing to do until Mary and I played the Friday afternoon and evening 299 pairs.  We did OK in the afternoon (52%, 0.46 MP red), but we really hit the jackpot in the evening pairs/team game, with a 61% for 3.81 MP red.  Mary was ecstatic (I was pretty happy too!), and it was a wonderful way to end my first Gatlinburg experience.

Mary and I managed a 61% game, taking 1st overall and 3.81 red

Mary and I managed a 61% game, taking 1st overall and 3.81 red

Gatlinburg Regional Mug/Pencil Holder

Gatlinburg Regional Mug/Pencil Holder

All in all, I had a wonderful time, got to meet and play with some tremendously nice folks, and even got a few points in the bargain (no gold though, drat!).  I’ll be back there next year, Lord willin’ and the creek don’t rise!



Gatlinburg, Tn NABC Regional, Part II

Posted 04/17/15

I’m writing this from my hotel room Friday morning, killing time before the afternoon pairs sessions start at 1pm.  This is my last day here at the Gatlinburg tournament, and I must say I’ve gotten my money’s worth (not in points, unfortunately, but in fun and experience).  I was told that this was a great regional to play in, and I certainly agree with that assessment now.  The organization was superb, the facilities great, and the people uniformly pleasant and helpful; doesn’t get any better than that (well, I could have played a lot better, but that’s not their fault;-) ).

Hugh, Judy, Dee and I played in a Knockout (KO) game Monday afternoon, as we had been told this was the best route to gold points.  In the KO format, teams of 4 compete against other teams in a 12-board Swiss Team game, and the losing team is ‘knocked out’ of the competition.  If you win a couple of rounds of this, you are pretty much assured of getting some gold points.   However, the downside is if you lose, you are out of the game entirely.  Well, we basically got our rear ends kicked, so our hopes for gold points were dashed  pretty soundly.  Being the persistent sorts, Hugh and I tried again the next day with a pickup team, and this time we got through one round before being KO’d, and we even tried a 3rd KO game the next day with another pickup pair, and again got KO’d on the first round.  This was pretty disappointing, as we thought we were bringing a pretty decent game to the party.  In retrospect it looks more like we brought knives to a gunfight! ;-).

After that, Hugh and I decided we would try our luck at the partnership desk, and I got hooked up with a ‘young’ (30 pts) player from Marrietta Ga, named Mary.  She and I were able to put together a 40% for the first session of a two session ‘Gold Rush’ pairs game, and a 57% for the second one. We got some red points for the 57% game, but because we hadn’t done well in the first session, we missed out on the gold. :-(.  We did, however, have a lot of fun, so that was it’s own sort of ‘gold’.  The next day (Thursday), Mary and I played in another Gold Rush 2-session game, but were unable to get out of the 40’s for either session.  After that, Mary suggested we try the stratified 2-session game for Friday, thinking that the non Gold Rush fever types might be a little bit easier for her, and I agreed.

So, Mary and I will play these last two sessions today, and then I’ll be on my way back home again tomorrow morning, in my red Ford F-150 with ‘Lucifer’s Hammer’ on the CD player again.  I won’t be taking any gold back with me, but I will be taking memories of some really great bridge played with some really great people, in a very interesting setting.  Lord willin’ and the creek don’t rise, I’ll be back here again next year! ;-).



Gatlinburg, Tn NABC Regional, Part I

Posted 04/12/15

I’m writing this from my room in the Le Conte View Motor Lodge, right across the street from the Gatlinburg Convention Center, site of the 2015 Gatlilnburg NABC Regional Tournament.  I’m down here with Hugh, Trish, Judy and Dee from the Columbus Bridge Center, hunting for gold “in them there hills” ;-).

I didn’t really know what to expect when I started this adventure – I just wanted to come down here and play some bridge, maybe earn a few points and experience a regional tournament.  I drove myself in my trusty Ford F-150 pickup (not your normal bridge vehicle, that’s for sure!).  I put the hotel address into my Tom Tom GPS, and ‘Lucifer’s Hammer’ by David NIven into my CD player, and hit the road, expecting to arrive in some sleepy town in southeastern Tennessee.  What I did not expect was the abrupt transition from suburban Knoxville to some sort of combination of alternate-reality,  fun-house carnival, beach resort, and mountain hideaway!  I first realized something strange was going on when  I started passing Hollywood-themed establishments packed side-by-side with each other; King Kong clinging to a skyscraper on this side, the Titanic complete with water rushing by its bow on the other, and a 3-story upside-down courthouse, complete with upside-down lawn and trees!  Then there was another abrupt transition from all the fun-house madness to an idyllic mountain road (albeit a modern 4-lane one) by an idyllic mountain stream, with no human habitations in sight.  This continued up into the Smoky Mountains right into the city limits of Gatlinburg.  In fact, I had begun to wonder whether I had missed a turn or something, when, with no warning at all, I was deposited back into the fun-house/beach resort alternate reality.  Ripley’s Museum, a quickie marriage chapel, a ‘Space Needle’ (how did I get from Tennessee to Washington state?), and everything else a person might dream of (in a nightmare about being lost on the boardwalk of a beach resort).  People everywhere, walking along the one main street.  Cars everywhere, driving at 5mph.  Long lines of motorcycles, also driving 5 mph, most with two riders.  Pickup trucks filled with hillbillies with the confederate flag prominently displayed.  Buildings crammed together check-by-jowl as if every square inch of real estate was more precious than gold (and I suspect it is!).  I found my hotel without any problem, because it, like every other hotel/motel in Gatlinburg, fronts on the one main street.  As I pulled into the hotel parking lot, I noticed that the hotel buildings (there are three, I think) are all oriented perpendicular to the street, reinforcing the impression that street frontage is hugely expensive.

Rooftops looking southeast from my hotel room

Rooftops looking southeast from my hotel room

Looking east from my room.  The convention center can be seen in the background, just across the street from the hotel

Looking east from my room. The convention center can be seen in the background, just across the street from the hotel

Looking northeast from my hotel room, the Gatlinburg 'Space Needle'

Looking northeast from my hotel room, the Gatlinburg ‘Space Needle’

Le Conte View Motor Lodge, seen from the steps of the convention center

Le Conte View Motor Lodge, seen from the convention center

I got checked into my room and decided to walk around a bit and get myself oriented for tomorrows tournament start.  I found the convention center OK (right across the street, hard to miss), and wandered around inside a bit.  I peeked into the main playing area on the first floor, and was in for another shock.  The main room is at least 100 yards long and at lest 50 yards wide, completely full from edge to edge with bridge tables.  Down the middle of this huge room was a line of bridge tables with a single chair sitting on top of the table; For a while I thought this was maybe a setup mistake, but there were too many of them for that.  Then I realized there was one such table for every column of tables – they must be game section boundaries of some sort.  Later, after taking the phtograph below, I realized that it showed only one half of the main playing area – there’s another entire section beyond the far wall!

The main playing hall.  There is another complete playing area behind the far room divider

The main playing hall. There is another complete playing area behind the far room divider

After this I walked from the convention center to what I think was the southern edge of town – maybe 1/2 mile – no more.  And each foot of the way was crowded hotels, restaurants, the fore-mentioned quickie marriage chapel, a real church right next to it, tatoo parlors, tee-shirt/gift shops, and everything else imaginable.  The other way from the hotel was the same – every imaginable themed entertainment/fun ride establishment, plus lots of themed restaurants (Bubba Gump Shrimp Co, for one), plus a few ‘normal’ franchises like Dunkin Donuts, Five Guys Hamburgers, and TGI Friday thrown in for good measure.

All this incredible variety of tourist-oriented businesses crammed into such a tight area stoked my curiosity, so I spent some time reviewing the town’s history on Wikipedia.  Turns out it’s location at the entrance to the Smokey Mountain National Park made it a natural tourist stop. From Wikipedia: in 1912, the town consisted of about 6 houses, a Baptist church, and a blacksmith’s shop.  In 1934 (the first year the park was opened), 40,000 tourists visited the town, with that number swelling exponentially to 500,000 within a year!  In 1992 an entire city block burned to the ground and was subsequently rebuilt (that explains the strange new/old character of the place, I guess).  Now the place is all hotels, motels, restaurants, and arcade-style game places of all descriptions, but no houses at all (or at least I never found any).

All for now – its late and I want to get some sleep before the opening day tomorrow.