Dealy generates random and tailored bridge hands for bidding practice and statistical study. Tap the Deal button to display the next hand. When working with a partner tap the Show all, Show next and Hide all buttons to control which hands are visible.
(Note: the hand display can be selected and copied to the clipboard and pasted to a text editor to create deal collections with formatting intact from most browsers except Firefox.)
Tapping Deal when the blue text box at the top contains no active filters produces random hands. ##Activating# a filter in the box will screen hands, displaying only those that meet your specific practice needs, per the rules you provide. Tap Run stats to see how often hands that satisfy your rules typically occur in the wild. (Results appear in the status area above the button rows.)
The sample size can be increased for filters with low expected hit rates (e.g. hands with rare distributions or valuations) by bumping up the maximum number of trial deals with the selector provided below the buttons. Note that statistics collection with more trials will take longer to complete.
Filters are written as JavaScript expressions. Let's see how that works.
When you tap Deal with some filter code selected in the filter box
Dealy will repeatedly deal hands until either a) one appears that satisfies the filter or
b) it reaches its trial count limit.
Dealy extracts several metrics from each hand it deals, including
high card points, losers, quick tricks and distributional measures. The
filter provides user access to these metrics.
Let's look at an example.
Type ##HCP(S) > 11# (not case sensitive) into
the filter box and tap Deal, telling Dealy to start dealing,
examining each deal for a South hand that has more than 11 points. When such a hand
is found Dealy stops dealing and displays the hand. This filter
rejects all hands where South holds 0-11 points.
Tap Run stats and Dealy will screen a collection of
deals and display how often South received a 12+ point hand.
OK, ##HCP(S) > 11# looks pretty cryptic!
Let's break down how this filter code works. First off, the filter text box
allows you to store several filters at once. These are saved and restored from
session to session so, over time, you can build up a filter library.
The active (selected) filter begins after the first double hash mark encountered
and extends to the next hash mark. If no '##' is found no hand filtering will be performed.
(To easily structure a filter library bracket filters with hash marks, then simply add
one # to make a selection.
For clarity, the remainder of this guide excludes hash marks from examples.
Filters entered into the filter box access a deal's
metrics with codes such as HCP called a metric term. Terms are followed by one or two arguments in parentheses. The first argument is a letter indicating the table direction - N, S,
E or W. The South hand is indicated in our example.
The second argument is optional and (usually) refers to
one of the four suits - S,
H, D or C, for spades,
hearts, diamonds or clubs, respectively. If absent the term examines all four suits.
Dealy expects filters to produce a logical value - true or false - at the conclusion
of every hand's filter processing. A true result causes the current hand to
be displayed, false results in Dealy dealing another hand and trying the filter again.
So far we've seen a metric term, HCP(S), that produces a
number - the total points in the South hand of the current deal. The next step is to
compare this value to a number (11), producing the logical value that
Dealy needs to assess whether or not the hand satisfies the filter. This is performed
with Javascript relational operators: == (equal), != (not equal), > (greater than), < (less than), >= (greater than or equal) and <= (less than or equal). Multiple tests can be combined with Javascript logical operators: && (and), || (or) and ! (not).
We now can decode the meaning of our example, HCP(S) > 11, like this:
HCP(S) returns the high card points for the South hand which is then checked to see if it exceeds 11. The whole filter returns either true or false.
From these primitives complex filters are easily assembled. A first cut at
a filter that displays only deals with an opening hand in the South opposite a
hand that would respond might be constructed thus:
HCP(S) > 11 && HCP(N) > 5. Be sure to select this
filter by bracketing it with ## and # and tap Deal
to show such a hand; tap Run stats
to see how often you can expect such holdings to occur.
Logical and (&&), or (||) and not (!) are available to combine hand metric functions. Note the relational operators are == != > < >= and <=. Metric functions have a table direction argument, N S E W, and optional suit parameter, S H D C. Metric functions include:
While Dealy offers a variety of metrics and operators, sometimes
you have to think a bit outside the box to get exactly the filter
functionality that you want. The examples below illustrate
such thinking along with a selection of conventional filters.
It's easy to make deals where two hands combine to have some minimum strength.
This filter forces North-South have a at least 26 points:
Here's an easy way to give South 15-17 point 1NT hands by requiring the balanced
distribution metric to have some minimum value, allowing a five card minor but
no five card major:
Here's a non-obvious way to force an honor combination
into a suit. To put exactly the AQx of spades in the South hand the filter
checks for six points with the
spade ace and a suit length of exactly three. There's no need
to look specifically for the queen or write checks that reject
the king and jack.Filter Concepts
Javascript Filter Summary
Filter Tips and Examples
HCP(N) + HCP(S) > 25
HCP(S) > 14 && HCP(S) < 18 && BAL(S) > 1
HCP(S,S) == 6 && CD(S,SA) && LEN(S,S) == 3