yojimbos_law

nuns simulator (with copier and sing along)

Jun 5th, 2018
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. int meat_remaining;
  2. int turn_counter;
  3. int total_turns_sans;
  4. int total_turns_with;
  5.  
  6. int rround(float butts){
  7. float remain = butts%1;
  8. if(remain * 100 <= random(100)){
  9. return floor(butts);
  10. }
  11. else{
  12. return floor(butts+1);
  13. }
  14. }
  15.  
  16. void simulate_nuns(float meat_boner, int times){
  17. total_turns_sans = 0;
  18. total_turns_with = 0;
  19. //nuns without singing along.
  20. for i from 1 to times{
  21. meat_remaining = 100000;
  22. turn_counter = 0;
  23. //continue until 1-2 monsters' worth of meat left.
  24. while(meat_remaining > floor(1200*(1+meat_boner))){
  25. turn_counter++;
  26. meat_remaining -= rround((800 + random(201) + random(201))*(1+meat_boner));
  27. }
  28. //if we can't guarantee being done in 1 turn, add 2 turns.
  29. if(meat_remaining > floor(800*(1+meat_boner))){
  30. turn_counter++;
  31. turn_counter++;
  32. }
  33. else{
  34. turn_counter++;
  35. }
  36. total_turns_sans += turn_counter;
  37. /*
  38. if(i%50000 == 0){
  39. print("simulations+=50k.");
  40. }
  41. */
  42. }
  43. //nuns with singing along.
  44. for i from 1 to times{
  45. meat_remaining = 100000;
  46. turn_counter = 0;
  47. //continue until 1-2 monsters' worth of meat left.
  48. while(meat_remaining > floor(1230*(1+meat_boner))){
  49. turn_counter++;
  50. meat_remaining -= rround((820 + random(201) + random(201) + random(11))*(meat_boner+1));
  51. }
  52. //if we can't guarantee being done in 1 turn, add 2 turns.
  53. if(meat_remaining > floor(820*(1+meat_boner))){
  54. turn_counter++;
  55. turn_counter++;
  56. }
  57. else{
  58. turn_counter++;
  59. }
  60. total_turns_with += turn_counter;
  61. /*
  62. if(i%50000 == 0){
  63. print("simulations+=50k.");
  64. }
  65. */
  66. }
  67. float EV_sans = (total_turns_sans.to_float()) / (times.to_float());
  68. float EV_with = (total_turns_with.to_float()) / (times.to_float());
  69. print("EV with singing and +"+((meat_boner-1)*100)+"% meat: "+EV_with.to_string());
  70. print("EV sans singing and +"+((meat_boner-1)*100)+"% meat: "+EV_sans.to_string());
  71. print((EV_sans-EV_with).to_string()+"turns saved by singing with +"+((meat_boner-1)*100)+"% meat");
  72. }
  73.  
  74. for j from 1 to 20{
  75. simulate_nuns((1+j.to_float()*0.5),100000);
  76. }
Advertisement
Add Comment
Please, Sign In to add comment