Hi, bridge pals!
Long-time subscribers know that posts in Computation Corner tend to be heavy on topics of interest to programmers, and possibly of zero interest to everyone else. This post has to do with a major change to the bridge deal generator that will likely interest everyone. The change will affect many parts of the user guide, so if you are more interested in the “what” than the “how’d that happen,” just keep an eye on the user guide for updates over the next few days.
The more daring and intrepid among you may go ahead and try to use this new feature right away.
I have often wondered: if they don’t want you to press the red button, why do they make it so darned attractive? Look how shiny! Heck, I tried to press it and it’s just a picture! Gotta clean my computer screen now.
Well, now we have our very own super-tempting red button:
Go ahead—click it. You know you want to. What’s the worst that could happen?
Ew. It’s grinning at me and saying “Shapely.” What the heck does that mean?
What it means is that the Deal Recipe Maker panel is now integrated with the Deal Shaper panel! “Shapely” does not mean that you (the user) are looking fine, though no doubt you are. It means that the deal in the Generated Deal panel, which was generated when you pressed “Red Button,” conforms to the shape described in the Deal Shaper panel.
You might think it is obvious and natural that you would want the shaper and the recipe maker to work together, and you would be correct. But until now, they operated completely independently from each other. It was that way because the shaper and the recipe concepts grew out of the original “Customized Deal” feature of the earlier version of the bridge deal generator.
The Customized Deal page let you select from a large menu of deal types, then you could select a point range for everyone but the dealer. That was a nice feature when it worked, but it let you select impossible deal type and point combinations. There was nothing to detect the impossible requests, so the deal generator would run in an endless loop while trying to find a suitable deal.
I eliminated the impossible deal problem with the second generation of the generator, but to do so I severed the connection between deal types and point ranges. Shape and point range were done with a shaper; deal types (that is, card configurations) were done with a recipe. This arrangement worked, but it placed a large computation and cognitive burden on the user. To develop a recipe, you would first create a shaper to generate a candidate deal with the correct shape and point range in each hand. Then you could copy that deal into the recipe maker panel, and there you could turn a one-off specific deal into a general recipe. Along the way, your changes would very likely alter the shape and the potential point ranges that you got courtesy of the shaper, so you had to constantly evaluate your resulting deals to make sure you got something close to what you wanted.
While it prevented impossible deal requests, this was the opposite of a labor-saving device, and it often resulted in unsatisfactory recipes. Clearly, the shaper and the recipe maker need to work together.
But how to do that without going back to the bad old days of long-running impossible deal requests?
The answer, my friend, is to combine shaper and recipe maker functionality, but to allow the user to approach it in an experimental fashion to verify the validity of a recipe before turning the program loose on it. Yes, just as this deal generator contains precious little actual bridge knowledge, leaving the user to codify their knowledge in expressive recipes, it also provides a potentially long-running deal beast, leaving the user to know when to take the leash off and let it run.
Let’s look at an example.
When creating a new recipe, first limit the damage (wasted time) from recipes run amok. Set the Maximum Number of Shuffles to the lowest value:
Now, let’s start with a shaper. I want a deal where every hand has 10 HCP, North is balanced, and the other seats have any shape. I put that into a shaper and pressed the “Generate” button of the Shaper panel and got this perfectly valid deal:
So, we have a shaper. Now, let’s combine that with a recipe. You can only combine shaper and recipe functionality by pressing “Generate” or “Red Button” of the Deal Recipe Maker. When you generate from the Shaper panel, you only get shaper functionality. This is by design.
In the Deal Recipe Maker, request six cards in spades for North:
Now click the “Generate” button. You should see this:
Well now. That North hand with six spades and two singletons is NOT balanced, is it? In what sense are shaper and recipe functionality combined?
They are indeed combined, but when you use the “Generate” button of the recipe maker panel, shaper and recipe maker work together only in an advisory capacity. The generator takes only one shuffle to create a deal from the Recipe Maker, because it distributes the cards according to your recipe first, then distributes any remaining cards randomly. The one-pass recipe generator does not make the deal conform to the point ranges in the shaper panel.
But see that yellow dizzy face and the “Not shapely” message next to it? That is telling you that the one pass created a deal that is valid in the world of bridge, but that it does not conform to your shaper. So it generates to fulfill just the recipe, but then it checks it against the shaper requirements and tells you what it found.
When you are told that a deal resulting from a recipe is not shapely, you can do as I do, and press “Generate” a dozen or fifty more times, hoping to find a Shapely deal without having to think too hard. But if you never get the smiley face after many button clicks, then you can resort to the Red Button. Press it, and you should see this within a second or two:
It’s not really “All OK”. My alert messages need some work. But you get the gist of it. With the Red Button, the generator doesn’t stop after one shuffle and then build you a non-conforming deal. Instead, it keeps shuffling and searching until it finds a conforming deal, or until it hits your Max Shuffles limit.
Hitting the Max Shuffles limit tells you that your shaper and recipe combination is either impossible or very rare. So now, finally, you have to think: do you increase the Max Shuffles limit and keep searching no matter how long it takes, or do you finally start thinking about your configuration?
Did you know you can set Max Shuffles as high as 100,000,000? That’s one-hundred million, American-style. Not recommended with dodgy deals, because it takes vastly longer to run that many shuffles than it takes to run 10,000. It could, coincidentally, take 10,000 times longer.
No, you’re going to have to think, after first cursing The Fates.
In this case, the problem is easy: I requested a balanced North hand in the shaper, but I requested a six-card spade suit in North in the recipe maker. That is an impossible combination. If I knock it down to five spades in North, this happens when I press the Red Button:
Thank goodness! We’re back to the creepy yellow guy smiling and saying “Shapely,” and you can see the deal in the Generated Deal panel conforms to the shaper/recipe combination. Sweet!
In actual practice, any errors might not be so obvious. You are more likely to be engaged in trying to create edge cases to explore some convention or other, and in the process you will create a shaper/recipe combination that is impossible but whose flaw is not so easily seen. But at least now you have a way to work up to discovering that fact without letting the generator run endlessly. Then, once you dial in the configuration and prove that it is possible, you can raise the Max Shuffles limit and use that recipe without fear of your browser locking up while the generator churns forever(ish).
I keep going on about saving you from long-running generators, and that is a great benefit. But the best part, for me, is that once I know that a recipe is valid at all, I no longer have to suffer through mentally evaluating one generated deal after another. I can instead use the Red Button and know that I will see only valid, conforming deals.
I made this reunification of shape/points/layout to address pain points that arose when I began once again rebuilding this cookbook from scratch. Before writing this post, I used the Red Button feature for a day to help me create a few recipes for that cookbook. While the final recipes are not live on that cookbook page yet, I can happily report a vast reduction in pain, and a concomitant increase in smug satisfaction, when working on them. I hope it works as well for you.
Happy dealing!