Jump to content

Recommended Posts

citrus    21

Hey guys, I spent the last couple weeks building this R-script: http://pastebin.com/f0xF17rf

I don't have much programming experience, so I apologize for this not being wrapped up in a neat executable or web app.

 

Fleshed-out description and instructions are in the pastebin link, but here's the tl;dr.

 

Use this script to:

  • Generate all possible unique hands for a particular deck list (learn decks, find unplayable hands, etc.)
  • Calculate percentages of hands that contain specific combos (test ratios, measure consistency, etc.)
  • Basically a more technical, open-ended variation of Inexorably's consistency programs

 

To use the script, you'll need R v3.3.1: https://www.r-project.org/

An editing environment helps. I use RStudio: https://www.rstudio.com/products/rstudio/

After you're set-up:

  • Type up your deck list in the correct format
  • Open the script or paste the code into a new script
  • Set the working directory to where your deck list is
  • Source the script
  • Have fun

 

The tool produces a list of five objects:

  • [[1]] a data frame copy of the deck list
  • [[2]] a matrix of all unique hands by row (readable if hgen = TRUE)
  • [[3]] a vector of the number of times each unique hand repeats (readable if hgen = TRUE)
  • [[4]] the vector of criteria passed to 'crit' for criteria testing
  • [[5]] the percentage of all possible hands that pass criteria

The results of [[2]] and [[3]] will not be readable (useful) if hgen != TRUE, because the tool will pre-filter the deck list and set any cards that don't meet criteria to <NA> before generating hands.  (This saves considerable run time when the deck size is large and the deck contains a high proportion of unique cards--run at only 1 or 2 copies.)

 

The idea behind the program as a whole is to save time and maximize accuracy by avoiding simulation.  For example, given a 40-card deck, the number of maximum unique hands is given by choosing 5 from 40, which is only 658,008 hands (assuming all 40 cards in deck are unique).  Mike Steinman simulated 1,000,000 hands for his Monarch deck, which doesn't make any sense, because his simulation only gives him an approximation of a true statistic, when he could've performed fewer operations and just learned that statistic instead.  To be fair, just drawing 1 extra card increases the maximum number hands to 3,838,380 (e.g. for going second), but I have optimized the program to minimize run time.  If you're not running anything else, and you have 4GB of RAM, it shouldn't take more than a few minutes at most.

 

For stats guys, the percentages are  p >= x, not p == x, which means the criteria-passing hands may contain more than one copy of a particular combo piece (e.g. if you're testing for hands that open high scale and low scale Pendulums, the passing hands may contain more than one high or low scale).  These probabilities are, then, basically useless for calculating percentages of joint events that aren't mutually exclusive.  There was a previous implementation that allowed the option to choose between >= and ==, but it was messy, cumbersome, and easy to break.

 

Feel free to ask any questions.  Let me know if anything breaks.  Please use and enjoy.

  • Upvote 10

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.

×