const costFunction = (user, object) => {
switch (object.type){
case 0:
if(user.access[0]){
return object.cost * user.utility[0];
}else{
return Infinity;
};
case 1:
if(user.access[1]){
return object.cost * user.utility[1];
}else{
return Infinity;
};
};
};
for(var i=0; i < 500; i++) {
costFunction({ access: [true, false], utility: [2, 5]}, {type: 0, cost: 15})
costFunction({ access: [true, false], utility: [2, 5]}, {type: 1, cost: 15})
costFunction({ access: [true, false], utility: [2, 5]}, {type: 0, cost: 215})
costFunction({ access: [true, false], utility: [2, 5]}, {type: 1, cost: 215})
costFunction({ access: [true, false], utility: [2, 5]}, {type: 0, cost: 125})
costFunction({ access: [true, false], utility: [2, 5]}, {type: 1, cost: 125})
costFunction({ access: [true, false], utility: [2, 5]}, {type: 0, cost: 2145})
costFunction({ access: [true, false], utility: [2, 5]}, {type: 1, cost: 2145})
costFunction({ access: [true, false], utility: [2, 5]}, {type: 0, cost: 55})
costFunction({ access: [true, false], utility: [2, 5]}, {type: 1, cost: 55})
costFunction({ access: [true, false], utility: [2, 5]}, {type: 0, cost: 55})
costFunction({ access: [true, false], utility: [2, 5]}, {type: 1, cost: 55})
}