Showing posts with label Upgrades. Show all posts
Showing posts with label Upgrades. Show all posts

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.


Monday, February 12, 2024

Import your decklist

You can now use Deck-u-lator settings to import your decklist.  This can be a faster way to setup your calculation than entering cards one at a time.  Settings are accessible by clicking the gear icon at the top right of the screen.


Deck-u-lator recognizes any line that begins with a number and a space as a card in your deck.  Blank lines and lines that do not begin with a number and a space are ignored.  

WARNING: If there are multiple lines with the same card name, their counts are combined.  This means that if your decklist includes a sideboard, those cards and counts will be included.  If you do not want this, then delete the sideboard lines, or adjust the counts appropriately.


Saturday, February 10, 2024

Better support for longer calculations

With the latest upgrade, Deck-u-lator can calulate combinations including many more hands.  Mark had been trying to calculate larger combinations than could be finished within the Google App Engine limit of 60 seconds.  Now these longer calculations will show a progress bar with the amount of work that has been completed.


This required re-factoring the Deck-u-lator engine to return partial results and to continue a partial calculation.  The new engine is five times faster.

From the image above, you can also see that these changes are highlighted by switching to dark mode.

Saturday, January 20, 2024

New math formula for multiple hand combinations

The latest version of Deck-u-lator shows new math formulas for advanced calculations with two or three hands.  Previously multi-hand calculations simply confirmed how many alternate hand combinations you were calculating.  This is still the case for combinations with four or more hands.

To calculate your chances to draw alternate hands, Deck-u-lator performs the multivariate hypergeometric calculation for each hand and adds those probabilities together.  What about draws that contain all the cards needed for two different hands?  These get double counted by just summing probabilities for both hands.  So we calculate the probabilities for all combinations of two hands and subtract those.  This process continues, alternately adding probabilities for combinations of three hands, subtracting probabilities for combinations of four hands and so on.

The new formula gives a glimpse into this process.  Enjoy!

$$ \frac{ H_{0} + H_{1} - H_{0} \cap H_{1} }{ \binom{ 52 }{ 2 } } = 95.0\% $$

Sunday, November 5, 2023

2023 Upgrade to Python3 and Flask

Deck-u-lator has been upgraded to the latest Python environment on Google App Engine.  Google is ending support for Python 2.7, so moving to Python 3 was necessary to continue operating on this platform.  Deck-u-lator now uses the Flask micro web application framework.

The functionality from the Advanced page is now added to the main page with a button that will toggle between basic and advanced.  

Behind the scenes, the Javascript code has been simplified now that most modern browsers support XMLHttpRequest and JSON.  You may see error messages if you are using an older browser.

Thank you to those of you who have shared questions and feature requests.  

Saturday, March 16, 2019

Deck-u-lator history

Deck-u-lator is over eighteen years old.  Here is a look back to how it has evolved.

2001 Implair Perl CGI web application

Deck-u-lator launched in December 2001 when I was part of The Implair Group with Barry Reich.  The original calculator was implemented in Perl as a CGI script on the implair.com server.  Many of us at The Implair Group were Magic play testers.  I loved designing intricate combinations and became curious about how often I could actually draw them.

2010 Django on Google App Engine

After The Implair Group servers shut down, I moved the calculator to Google App Engine in November 2010.  This was a port to the Python 2.5 language and used Django web framework.  Since this time, the source code has been managed in the Git version control system.  Deck-u-lator changed to a single-page app generating graphs from Google charts.  This blog was started to provide documentation.  A REST API was described on the blog when this version launched.

2012 Upgrades

Deck-u-lator upgraded to Python 2.7 for the new Google High Replication Datastore and a new template engine, Jinja2.

2019 Advanced calculator for mobile

This winter I finally set aside time to add more advanced features to the calculator to cover alternate hands and maximum limits for cards in hands.  The user interface moved to a Bootstrap template for responsive display on smaller screens.  Formulas were added and the graph moved to the latest Google charts.

Thank you

Deck-u-lator is a passion project for me and I enjoy hearing from you about what you are doing with this calculator.  Who knows, your article or email may inspire changes for the next version.




Monday, January 21, 2019

Updates to Deck-u-lator

Deck-u-lator has just been updated with several changes.  I hope you enjoy the new functionality.

Better mobile experience
Deck-u-lator on a phone screen
Small screen view

Deck-u-lator is now a responsive web app with a display that adapts to smaller screens like phones and tablets.

Add a hand (advanced) 
Basic calculations are exactly as they were before.  Deck-u-lator has added an advanced calculator that lets you add alternate hands in your combination.  Thanks to Carson McFarlane who wrote to ask for "an 'or' function between cards".

Maximum (advanced) 
In the advanced calculator you can also enter an upper limit for the maximum number of a card to draw for your combination.  Thanks to Frank Karsten who wrote about calculations that are "not easy to do via Deck-u-lator".  I took that as a challenge to make it easier!  Maximum cards also work with alternate hands.

Better graphs 
Graphs are now updated to use the latest Google charts.  This interactive graph allows you to move the crosshairs.

Math formulas (multivariate hypergeometric) 
Thanks again to Frank Karsten for sharing formulas for more complex combinations.  I found them useful, so I added MathJax to display formulas for Deck-u-lator calculations.

Tuesday, April 24, 2012

Infrastructure Upgrades

The technology underlying the Deck-u-lator has been upgraded to the latest versions. This application now takes advantage of the High Replication Datastore and takes advantage of multithreading. There are also performance improvements due to faster page generation using a new template engine, using native Python language features for calculations and JSON processing.

Any change like this introduces the risk of changed functionality. If you see any problems, please contact me.

Monday, November 8, 2010

Long live Deck-u-lator

Deck-u-lator has moved to the Google App Engine.  There are several improvements in this this new version.

  • It is more accurate.  I have replaced the Stirling approximations of the factorial function with exact factorial calculations.
  • It is faster.  Several coding changes were made as I re-wrote this from Perl in Python.  Calculations for factorial and binomial coeffecients are cached.
  • It is more reliable.  Google's App Engine has better uptime performance than the Imp Lair servers.
  • It is easier to use.  Calculations have gone from three steps down to two.

Give it a try!  http://deckulator.appspot.com/