This blog post uses a very limited, simplified use case as the basis for discussion of automation of the bridge deal generator. It presents two already-existing methods for modifying creating modified versions of an input deal file; those methods, however, require a good deal of user interaction to accomplish. The point of describing every necessary user action is to surface those things that are candidates for automation.
The task: Given a set of deals from one scenario, select one source board in which North is the dealer with a hand conducive to opening 1NT. For the source board, produce a second board in which South is the dealer, and in which North and South’s hands are swapped with each other, and East and West’s hands are swapped. This will make it so that North and South can take turns bidding and playing the same scenario as dealer.
Source board 1 was generated from this recipe and saved to a PBN file and to a LIN file.
Reload deal generator website to show that nothing is hanging around in memory from generating the source board.
Use the “browse” button in the “Load from deal, shaper, recipe or navigator file” area to bring up the file selector and navigate to the folder where the source boards are stored. Load Source board 1 by double-clicking either the PBN or the LIN file.
Source board 1 is now loaded into the Generated Deal panel and into the Deal Recipe Maker panel. Click the curved arrow button in the Deal Recipe Maker panel two times to swap North with South and East with West. You can get the same effect by clicking the N←>S button and the W←>E button one time each. On the far left of the page, change the Dealer from “Rotate” to “South”.
Now click the “Generate” button of the Deal Recipe Maker panel to generate this deal into the Generated Deal panel.
Save the resulting deal to a PBN file and to a LIN file. Copy the source board files into the output boards folder. Use a command-line program or a text editor to combine the contents of Source board 1 and the rotated version into one file.
In the deal generator, use the “Browse” button to load the output deal file containing two boards. You can see from the “Number of deals” count on the left side of the page that two deals were loaded.
You can then create and open a Deal Navigator file (HTML page) and see your two boards set up as requested.
The above steps were purposely done one careful step at a time to achieve the exact desired result: two boards with hands and dealer swapped. I should point out, though, that rotating dealer and vulnerability are built-in capabilities, and if you request certain magical numbers of deals you will also get automatic swapping or rotating of hands from one seat to another. All is explained here, but I’ll just show you how it works for our Source board.
Here I have reloaded our Source board 1 from its LIN file, so we see it in the Generated Deal panel and in the Recipe Maker panel again. Off to the left in Number of Deals, I have selected 32 deals.
Now I click on the “Generate Deal” button of the Recipe Maker panel, and you can see from the board number in the Generated Deal panel that 32 deals were generated (when more than one board is generated, that panel always displays the last one generated).
Now if you create and open a navigator file, you can see that Board 1 is still your original Source board 1 with dealer in North and the deal exactly as originally designed.
With the “32 & 64 special” feature, when you request 32 boards it generates the first 16 with the cards in their original hands, while rotating dealer and vulnerability. Then it swaps North and South’s hands with each other, and swaps East and West’s before generating boards 17 through 32, with dealer and vulnerability in the same order as for boards 1 through 16.
You can save all 32 boards to a single file, or you can pick out individual boards and save them to files for later combining into one file using command line tools or a text editor.
This demonstrates that we already have one built-in method of automatically rotating and swapping boards, exactly because it is very common to want to repeat a scenario around the table.
It is therefore possible to code other file and board manipulation functions that could be invoked with a button click. This could be done either as canned routines, with or without user-selected options, or as a generalized scripting capability where, for instance, the user might either record or select a sequence of interactions with the program to create a script, then run that script against any set of files containing deals or recipes.