# Change N where N is the desired number of runs BEGIN { N=500; srand(); gas_tank = 3; } m4_include(includes/base_awk.m4) Choice(miles_driven,=,n) { return linear(miles_driven_min,miles_driven_max,n); } Choice(number_of_adult_passengers,=,n) { return linear(number_of_adult_passengers_min,number_of_adult_passengers_max,n); } Choice(number_of_child_passengers,=,n) { return linear(number_of_child_passengers_min,number_of_child_passengers_max,n); } Choice(mph,=,n) { return linear(mph_min,mph_max,n); } Choice(wp,=,n) { return linear(wp_min,wp_max,n); } Choice(magic,=,n) { return linear(magic_min,magic_max,n); } Choice(xor1,=,n) { return linear(xor1_min,xor1_max,n); } Choice(xor2,=,n) { return linear(xor2_min,xor2_max,n); } Choice(no_effect1,=,n) { return linear(no_effect1_min,no_effect1_max,n); } Choice(no_effect2,=,n) { return linear(no_effect2_min,no_effect2_max,n); } function xor_eval(x1,x2){ if((x1>50&&x2>50)||(x1<50&&x2<50)){ return 0; }else{ return 100; } } function mpg_calc(mph){ if(mph>0&&mph<10){ return 25; } if(mph>10&&mph<20){ return 13; } if(mph>20&&mph<30){ return 9; } if(mph>30&&mph<40){ return 13; } if(mph>40&&mph<50){ return 16; } if(mph>50&&mph<60){ return 20; } if(mph>60&&mph<70){ return 11; } if(mph>70&&mph<80){ return 5; } else return 3; } function isMagic(magic_var){ if(magic_var>30&&magic_var<35){ return 100; }else{ return 0; } } function worth(md,noap,nocp,mph,m,wp,x1,x2,ne1,ne2){ if(((((mpg_calc(mph)*(wp/100))/((1.3*noap))*(1.05*nocp))*gas_tank)-md)<0){ return 0; }else{ return (md*(noap+nocp)*mph)*isMagic(m)*xor_eval(x1,x2); } } function main( n) { miles_driven(n); number_of_adult_passengers(n); number_of_child_passengers(n); mph(n); wp(n); magic(n); xor1(n); xor2(n); no_effect1(n); no_effect1(n); return worth(miles_driven(n),number_of_adult_passengers(n),number_of_child_passengers(n),mph(n),magic(n),wp(n),xor1(n),xor2(n),no_effect1(n),no_effect2(n)); } #############################################