text: /*
   * count-things - how many items are generated across 25 levels?
   *
   *   make count-things && ./count-things | r-fu summary
   *
   * https://github.com/thrig/r-fu
   */
  
  #include "rogue.h"
  
  #define MAXOBJ 9
  #define TRIALS 30
  
  unsigned long how_many_things(int level);
  unsigned long n_levels(int maxlevel);
  
  int main(void) {
      for (int trial = 0; trial < TRIALS; trial++)
          printf("%lu\n", n_levels(25));
      return 0;
  }
  
  unsigned long n_levels(int maxlevel) {
      unsigned long count = 0;
      for (int level = 0; level < maxlevel; level++) {
          // the seed will (probably) be somewhere else for each new level
          seed = arc4random() & RN_MAX;
          count += how_many_things(level);
      }
      return count;
  }
  
  #define max(a, b) ((a) > (b) ? (a) : (b))
  
  unsigned long how_many_things(int level) {
      unsigned long count = 0;
  
      // TODO copy this from newlevel.c
      int odds = 119 - level * 20;
      odds     = max(35, odds);
  
      for (int i = 0; i < MAXOBJ; i++) {
          // original tarball odds
          // if (rnd(100) < 35) count++;
          if (rnd(100) < odds) count++;
      }
      return count;
  }
  
  /*
  
  outcomes over 25 levels with the original 35% odds of item drop:
  
    0%  25%  50%  75% 100%
    58   74   79   84  104
  
  the current version (at time of writing) has about 20 more items per
  game than the above
  
  */
  