Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //initial queue state having none of the NCs
- > run queue quest simulator.ash
- with an olfactiony thing adding 6 additional copies
- we spend an average of 2.73708 turns, give or take 2.164906451049976 turns
- to encounter 1 of a noncombat in a place with 4 noncombats
- =================================
- //initial queue state having all of the undesirable NCs
- > run queue quest simulator.ash
- with an olfactiony thing adding 6 additional copies
- we spend an average of 2.34463 turns, give or take 1.7646334753744415 turns
- to encounter 1 of a noncombat in a place with 4 noncombats
- =================================
- //assumptions: http://kolspading.com/forums/viewtopic.php?f=2&t=455
- //source code:
- int[int] buffer_queue;
- boolean olfacted = false;
- int nc_select_with_olfaction(int n, int copies, int skippable, boolean rejecting){
- int selection = -1;
- boolean in_queue;
- int rejection_roll = n+copies+1;
- while(selection == -1){
- if(olfacted){
- selection = min( random(n+copies) , n-1 );
- if(selection != n-1 || rejecting){
- in_queue = false;
- for i from 1 to 5{
- if(selection == buffer_queue[i]){
- in_queue = true;
- }
- }
- if(in_queue){
- rejection_roll = random(4);
- if(rejection_roll != 1){
- selection = -1;
- }
- }
- }
- }
- else{
- selection = random(n);
- in_queue = false;
- for i from 1 to 5{
- if(selection == buffer_queue[i]){
- in_queue = true;
- }
- }
- if(in_queue){
- rejection_roll = random(4);
- if(rejection_roll != 1){
- selection = -1;
- }
- }
- }
- }
- if(selection >= skippable){
- for i from 2 to 5 {
- buffer_queue[i-1] = buffer_queue[i];
- }
- buffer_queue[5] = selection;
- }
- if(selection == n-1){
- olfacted = true;
- }
- return selection;
- }
- int trials = 100000;
- int monster_counter;
- int monsters_in_place = 4;
- int monsters_to_find = 1;
- int banishes_available = 0;
- int extra_copies = 6;
- boolean rejectiness = true;
- int[int] trial_combats;
- int[int] trial_banishes;
- boolean[int] banishes;
- int turns_since_nc;
- float average;
- float sexually_transmitted_disease;
- clear(trial_combats);
- clear(trial_banishes);
- for i from 1 to trials{
- trial_combats[i] = 0;
- trial_banishes[i] = 0;
- monster_counter = 0;
- buffer_queue[1] = -1;
- buffer_queue[2] = 0;
- buffer_queue[3] = 1;
- buffer_queue[4] = 2;
- buffer_queue[5] = -1;
- /*
- buffer_queue[1] = -1;
- buffer_queue[2] = -1;
- buffer_queue[3] = -1;
- buffer_queue[4] = -1;
- buffer_queue[5] = -1;
- */
- olfacted = true;
- turns_since_nc = 0;
- while( monster_counter < monsters_to_find){
- while(random(100) < 100-45 && turns_since_nc < 10){
- trial_combats[i]++;
- turns_since_nc++;
- }
- if( nc_select_with_olfaction( monsters_in_place , extra_copies , 6 , rejectiness ) == ( monsters_in_place - 1 ) ){
- monster_counter++;
- trial_combats[i]++;
- }
- else{
- turns_since_nc = 0;
- }
- }
- }
- string textiness = "";
- if(!rejectiness){
- textiness += " and removing rejection";
- }
- print("with an olfactiony thing adding "+extra_copies+" additional copies"+textiness);
- foreach i in trial_combats{
- average += trial_combats[i];
- }
- average /= trial_combats.count().to_float();
- foreach i in trial_combats{
- sexually_transmitted_disease += ( trial_combats[i].to_float() - average ) ** 2;
- }
- sexually_transmitted_disease /= trial_combats.count().to_float() - 1.0;
- sexually_transmitted_disease = sexually_transmitted_disease ** (0.5);
- print("we spend an average of "+average+" turns, give or take "+sexually_transmitted_disease+" turns");
- print("to encounter "+monsters_to_find+" of a noncombat in a place with "+monsters_in_place+" noncombats");
- print("=================================");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement