DRY code
parent
5f6e26cdb0
commit
62d72ef80f
|
|
@ -1,10 +1,16 @@
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
config: () => {
|
config: () => {
|
||||||
|
return {
|
||||||
|
...genBaseStats()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function genBaseStats() {
|
||||||
return {
|
return {
|
||||||
variance: Math.random() * 10,
|
variance: Math.random() * 10,
|
||||||
base: Math.random() * 10
|
base: Math.random() * 10
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -22,8 +28,10 @@ export function pull() {
|
||||||
|
|
||||||
export function getAverageReward() {
|
export function getAverageReward() {
|
||||||
const avg = this.config.base;
|
const avg = this.config.base;
|
||||||
this.config.variance = Math.random() * 10;
|
this.config = {
|
||||||
this.config.base = Math.random() * 10;
|
...this.config,
|
||||||
|
...genBaseStats()
|
||||||
|
}
|
||||||
console.log('slots real reward was: ' + avg);
|
console.log('slots real reward was: ' + avg);
|
||||||
return avg;
|
return avg;
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue