Saturday, August 29, 2026

Faster hand combinations

Calculation with more than one hand dramatically increases the calculation effort. Ten hands is 1023 terms and finishes instantly. Forty hands is 1.1 trillion, which would take roughly 230 days of CPU time.

But many combinations of hands have zero chance of being drawn. 

The latest performance improvement spends much less time on these impossible hand combinations. One test case went from 38.9 seconds to 1.3 seconds. With a 7-card draw, only 1618 of its 2,097,151 combinations are actually possible and 99.9% of the work was never needed.  Another test case with forty hands went from impossible to 0.03 seconds.



Comparing two decks

What happens to my odds if I change the deck? Add two lands, cut a spell, does the opening hand get better?

Turn on alternate deck in Input settings and the card table grows a second deck column, with a [+ deck] button or a delete control on each deck column. The card rows and the hands are shared between decks, only the deck counts differ.

Alternate decks

Each deck reports its own result and its own running total, and the chart draws one line per deck on a shared axis. Export and import work with both decks, so a saved decklist keeps the comparison.



Monday, August 24, 2026

Simple mulligans

 David asked for a basic mulligan calculation to compute \(1-(1-P)^N\) and that is now available on Deck-u-lator.  The settings panel has three mulligan options:

  • No Mulligan
  • Redraw multiple times (you specify 1-10)
  • One blind redraw
Mulligan settings to redraw 3 times

This is not the Magic London mulligan.  This is an independent redraw.  Think of this as discarding your hand, reshuffling your deck and drawing the same size hand again.

Results display along with your probability.  The calculation is all done in your browser after your results are returned.  This means you can change your mulligan calculation after you get your results if you forgot to set it before.
Mulligan information added to results

Keep those suggestions coming!


Saturday, August 22, 2026

Settings and Deck Table Updates

Since the decklist import feature back in February 2024, the front end of Deck-u-lator has been rebuilt from the ground up. Removing cards and hands is now driven directly by switches in the settings panel, so the table only shows the controls that apply to what you're building.

Delete buttons for cards and hands

Settings also got smarter about remembering themselves. Options that used to need re-entering now persist. A decklist pasted into the settings panel is remembered too, so the cards and counts come back the next time you open Deck-u-lator. And the page itself now opens in whichever theme, dark or light, your operating system already asked for.  Settings are stored in site data in the browser, so clearing the browser cookies and other site data will reset your settings.


Backend performance and reliability improvements

Deck-u-lator's calculation engine has been reworked for speed. Probability calculations run on faster internal data structures, so larger decks and combinations return results quicker. On a benchmark combination, the same calculation now finishes about 2.7 times faster than it did in 2024.

updated settings panel

If you just want a quick answer and don't need the chart or formula, the settings panel now lets you turn them off. Lowering the graph and formula limits there skips that extra work, so you get your result even faster.  Increasing the size of calculation steps means fewer breaks in long calculations.


Accessibility improvements

Since the last update in February 2024, Deck-u-lator has had a round of accessibility work aimed at making the calculator usable with a screen reader or a keyboard alone, not just a mouse. Every input in the card table is now labeled by its row and column (hand columns only get numbers once there's more than one hand to tell apart), the settings button and footer link have proper ARIA labels, and every slider announces itself the same way. A skip link and a real main landmark, with a sensible heading outline, now sit on every page, and every interactive control shows a visible focus ring so you can always tell where you are.

new focus ring on the draw input box

The calculation itself got the same treatment. Results and errors now announce themselves to assistive technology through live regions instead of just appearing silently on screen, the scrolling card table has its own keyboard stop so arrow keys can reach rows that used to be untabbable, and the results chart now comes with a generated text summary, since the charting library underneath it has no keyboard handle of its own. On top of all that, every page we route now runs through an HTML validator as part of CI, so markup regressions get caught before they ship.

None of this changes what the calculator does, only who can comfortably use it. Thanks to everyone who sent feedback, that's how most of this list got written.


Friday, February 6, 2026

Quickly calculate probabilities

A common question asked about Deck-u-lator is why does it take so long to calculate my combination. 

Time to calculate binomial coefficient

The fundamental calculation performed is the binomial coefficient.  Python can perform four million binomials coefficients per second using math.comb() function.

Deck-u-lator uses Python functools.cache to do these even faster, only calculating the result for each set of inputs once and remembering that result.

Time to calculte multivariate hypergeometric

When you draw exactly as many cards as are in your combination,  Deck-u-lator calculates the multivariate hypergeomatric once, with one binomial coefficient for each card in the combination (C) and one for the deck.  For a combination with 4 cards, binomial coefficient is calculated 5 times.  

Time to draw extra cards

When you draw more cards than your combination, Deck-u-lator calculates the multivariate hypergeometric for each different way to draw those extra cards.  The number of different ways to draw the extra cards is roughly the product of the number of cards C of each type in your deck.  In a 60 card deck, a three card combination where there are four of each card in your deck will calculate multivariate hypergeometric 64 times (\(4^C\) or \(4^3\))

Time to draw alternate hands

When your combination includes alternate hand columns, Deck-u-lator must calculate every combination of hand columns.  For H hand columns, there are \(2^H -1\) combinations to calculate.

Deck-u-lator also uses functools.cache to combine hand columns, making this a bit faster.

Total time to calculate your combination

To estimate the time it will take to complete your calculation, substitute C for the card rows in your combination and H for the hand columns in this formula:

$$ \frac {(2^H - 1) \times (4^C) \times (C + 1) }{4,000,000 } \text{ seconds} $$

A sample calculation with C=5 card rows and H=3 card columns

$$ (2^3 - 1) \times (4^5) \times (5 + 1) / 4,000,000 \text{ seconds} $$ 

$$ (7) \times (1,024) \times 6 /4,000,000 \text{ seconds} $$ 

$$ 0.01 \text{ seconds}$$