G2A Many GEOs
SHARE
TWEET

FL Silken Thread expedition sim

a guest Jun 6th, 2019 340 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.text.DecimalFormat;
  2.  
  3. /**
  4.  * For estimating EPA of the Silken Thread FL expedition using various supply
  5.  * sources
  6.  *
  7.  * @author umbralOptimatum
  8.  *
  9.  */
  10. public class expeditionStats {
  11.     // profit of test expedition in echoes
  12.     public static final int expeditionProfit = 125;
  13.     // Archaeologist's Progress needed to complete expedition
  14.     public static final int progressGoal = 30;
  15.  
  16.     /**
  17.      * Simulates expeditions, not taking supply gain into account
  18.      *
  19.      * @param tests
  20.      *            - number of expeditions to simulate
  21.      * @return an array of three doubles: net profit, action cost, and supply cost
  22.      *         in that order
  23.      */
  24.     public static double[] expeditionSim(int tests) {
  25.  
  26.         // current expedition number
  27.         int expedition = 0;
  28.         // progress on current expedition
  29.         int progress;
  30.         // rivals progress for current expedition
  31.         int rivals;
  32.  
  33.         // total supplies used across all expeditions
  34.         double supplies = 0;
  35.         // total actions used across all expeditions
  36.         double actions = 0;
  37.         // total echoes generated
  38.         double echoes = 0;
  39.  
  40.         while (expedition < tests) {
  41.             progress = 1;
  42.             rivals = 1;
  43.  
  44.             // starting the expedition
  45.             actions++;
  46.  
  47.             while (progress < progressGoal) {
  48.                 actions++;
  49.                 // if Airs of the Forgotten Quarter are at least 96, use A sign?
  50.                 if (Math.floor(Math.random() * 100) >= 95) {
  51.                     progress += 4;
  52.                 } else {
  53.  
  54.                     /*
  55.                      * During an expedition, you ideally want your final action to be Buccaneering.
  56.                      * That way, if you get A sign? you'll get as much value as possible from it,
  57.                      * but can still finish in one action the other 95% of the time. These rules are
  58.                      * the best order I've found for maximizing potential sign value without using
  59.                      * additional actions the rest of the time.
  60.                      */
  61.  
  62.                     if (progress == (progressGoal - 4) || progress == (progressGoal - 1)) {
  63.                         supplies++;
  64.                         progress++;
  65.  
  66.                         if (Math.random() < .25) {
  67.                             rivals++;
  68.                         }
  69.                     } else if (progress == (progressGoal - 2) || progress == (progressGoal - 5)
  70.                             || progress == (progressGoal - 8)) {
  71.                         supplies += 2;
  72.                         progress += 2;
  73.  
  74.                         if (Math.random() < .5) {
  75.                             rivals++;
  76.                         }
  77.                     } else {
  78.                         supplies += 3;
  79.                         progress += 3;
  80.  
  81.                         if (Math.random() < .5) {
  82.                             rivals++;
  83.                         }
  84.                     }
  85.  
  86.                     /*
  87.                      * This simulation assumes always having the ten spare supplies on hand.
  88.                      * Confronting the Lugubrious Seamstress also gives 5 CP Nightmares but this
  89.                      * happens rarely enough that they can be dealt with through normal play. The
  90.                      * random progress gain should always be enough to hit 30 for Silken Thread, but
  91.                      * I'm leaving it in there just in case.
  92.                      */
  93.                     if (rivals == 10) {
  94.                         actions++;
  95.                         supplies += 10;
  96.                         echoes -= 5;
  97.                         progress += 2 + Math.ceil(3 * Math.random());
  98.                     }
  99.  
  100.                 }
  101.             }
  102.             actions++;
  103.             expedition++;
  104.  
  105.         }
  106.  
  107.         // add net profit from the expeditions
  108.         echoes += tests * expeditionProfit;
  109.  
  110.         System.out.println(tests + " expeditions simulated");
  111.         System.out.println(echoes + " net echoes");
  112.         System.out.println(actions + " total actions");
  113.         System.out.println(supplies + " supplies used");
  114.         System.out.println((echoes / tests) + " average profit before supplies");
  115.         System.out.println((actions / tests) + " average action cost");
  116.         System.out.println((supplies / tests) + " average supply cost\n");
  117.  
  118.         double[] returnArray = { echoes, actions, supplies };
  119.         return returnArray;
  120.  
  121.     }
  122.  
  123.     /**
  124.      * Estimates EPA for simulated expeditions using Docks favours for expedition
  125.      * supplies
  126.      *
  127.      * @param stats
  128.      *            - array containing results from expeditionSim
  129.      * @param costEchoes
  130.      *            - echo cost of one favour in materials already on hand. E.x. using
  131.      *            Docks card requires 10 Rostygold, or 0.1 echoes
  132.      * @param costActions
  133.      *            - action cost of grinding materials needed for one favour
  134.      */
  135.     public static void expeditionDocksFavours(double[] stats, double costEchoes, double costActions) {
  136.  
  137.         // total echoes generated by simulation
  138.         double echoes = stats[0];
  139.         // total actions used across all expeditions
  140.         double actions = stats[1];
  141.         // total supplies used across all expeditions
  142.         double supplies = stats[2];
  143.  
  144.         /*
  145.          * Using each Docks favour costs .5 echoes rostygold on top of additional costs;
  146.          * rostygold is assumed to accumulate fast enough that it doesn't need to be
  147.          * ground (i.e. through visiting the Soldier and cashing in rats as needed)
  148.          */
  149.         echoes -= (.5 + costEchoes) * supplies / 4;
  150.  
  151.         /*
  152.          * Using each Docks favour costs two actions, one to obtain and one to cash in,
  153.          * plus any needed to grind materials
  154.          */
  155.         actions += (2 + costActions) * supplies / 4;
  156.  
  157.         String EPA = new DecimalFormat("#.####").format(echoes / actions);
  158.         System.out.println("Docks Favours (" + costEchoes + " echo cost, " + costActions + " action cost)");
  159.         System.out.println(EPA + " EPA\n");
  160.     }
  161.  
  162.     /**
  163.      * Estimates EPA for simulated expeditions using Strong-backed Labour for
  164.      * expedition supplies
  165.      *
  166.      * @param stats
  167.      *            - array containing results from expeditionSim
  168.      */
  169.     public static void expeditionSBL(double[] stats) {
  170.         // total echoes generated by simulation
  171.         double echoes = stats[0];
  172.         // total actions used across all expeditions
  173.         double actions = stats[1];
  174.         // total supplies used across all expeditions
  175.         double supplies = stats[2];
  176.  
  177.         // SBL costs a constant 13.5 echoes per 5 supplies
  178.         echoes -= 13.5 * supplies / 5;
  179.  
  180.         // two actions to acquire and cash in each SBL
  181.         actions += 2 * supplies / 5;
  182.  
  183.         String EPA = new DecimalFormat("#.####").format(echoes / actions);
  184.         System.out.println("Strong-backed Labour:");
  185.         System.out.println(EPA + " EPA\n");
  186.     }
  187.  
  188.     /**
  189.      * Estimates EPA for simulated expeditions using Whispered Hints for expedition
  190.      * supplies
  191.      *
  192.      * @param stats
  193.      *            - array containing results from expeditionSim
  194.      * @param hintsPerAction
  195.      *            - average hints per action from a particular grind
  196.      * @param costEchoes
  197.      *            - average echo cost of materials for one action in hint grind,
  198.      *            does not include cost of materials being ground. If grinding
  199.      *            creates those items, make this negative!
  200.      */
  201.     public static void expeditionHints(double[] stats, double hintsPerAction, double echoesPerAction) {
  202.         // total echoes generated by simulation
  203.         double echoes = stats[0];
  204.         // total actions used across all expeditions
  205.         double actions = stats[1];
  206.         // total supplies used across all expeditions
  207.         double supplies = stats[2];
  208.  
  209.         // actions spent acquiring supplies via hints (assuming 60/40 split in the
  210.         // supply results)
  211.         double supplyActions = supplies / 1.4;
  212.  
  213.         actions += supplyActions;
  214.        
  215.         // 60% chance of one Map Scrap
  216.         echoes += supplyActions * .1 * .6;
  217.  
  218.         // if any grinding is involved
  219.         if (hintsPerAction != 0) {
  220.             actions += 200 / hintsPerAction * supplyActions;
  221.             echoes -= 200 / hintsPerAction * supplyActions * echoesPerAction;
  222.         }
  223.         // if just using owned hints, or buying outright
  224.         else {
  225.             echoes -= echoesPerAction * supplyActions;
  226.         }
  227.  
  228.         System.out.println("Whispered Hints (" + hintsPerAction + " hints per action, " + echoesPerAction + " echo cost per action)");
  229.         String EPA = new DecimalFormat("#.####").format(echoes / actions);
  230.         System.out.println(EPA + " EPA\n");
  231.     }
  232.  
  233.     public static void main(String[] args) {
  234.         double[] stats = expeditionSim(10000000);
  235.         expeditionSBL(stats);
  236.         System.out.println("Free favours:");
  237.         expeditionDocksFavours(stats, 0, 0);
  238.         System.out.println("Docks card (.1 echo cost):");
  239.         expeditionDocksFavours(stats,.1, 0);
  240.         System.out.println("Galatea card (.5 echo cost):");
  241.         expeditionDocksFavours(stats,.5,0);
  242.         System.out.println("Galatea card (grinding hints at 150 per action):");
  243.         expeditionDocksFavours(stats,0,.33333);
  244.         System.out.println("Using owned hints for supplies:");
  245.         expeditionHints(stats,0,2);
  246.         System.out.println("Trading owned items to Tiger-Keeper:");
  247.         expeditionHints(stats,1100,10);
  248.         System.out.println("Grinding Tiger-Keeper items via Court");
  249.         expeditionHints(stats,138.46,-0.01993);
  250.         System.out.println("Various cards that give 150 hints");
  251.         expeditionHints(stats,150,0);
  252.         System.out.println("Respectable Landeau card");
  253.         expeditionHints(stats,150,-.6);
  254.        
  255.     }
  256. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top