This repository has been archived on 2024-03-13. You can view files and clone it, but cannot push or open issues or pull requests.
timekeeper/components/InfinityTester.vue

65 lines
1.5 KiB
Vue
Raw Normal View History

2022-01-04 22:41:36 +00:00
<template>
<div>
<button @click="add"> add {{addIncrement}} </button>
<button @click="stepup"> {{mulIncrement}}x addition per step </button>
<button @click="jumpup"> 10x more multiplication per step</button>
<button @click="toggletimer">Tick automatically</button>
2022-01-04 22:41:36 +00:00
</div>
</template>
<script>
import Decimal from "break_infinity.js";
2022-01-04 22:41:36 +00:00
export default {
name: 'InfinityTester',
2022-01-05 19:19:51 +00:00
data() {
2022-01-04 22:41:36 +00:00
return {
addIncrement: new Decimal(100),
mulIncrement: new Decimal(10),
bigValue: new Decimal(0),
timerRunning: false
2022-01-04 22:41:36 +00:00
}
},
beforeMount () {
window.setInterval(() => {
this.gametick();
},250);
2022-01-05 19:19:51 +00:00
},
methods: {
add () {
// this.bigValue = Decimal.add(this.bigValue, this.addIncrement);
this.$store.commit("incremental/add",
{key: "energy", value: this.addIncrement}
)
},
stepup () {
this.addIncrement = Decimal.mul(this.addIncrement, this.mulIncrement);
},
jumpup() {
this.mulIncrement = Decimal.mul(this.mulIncrement, 10.0);
},
gametick() {
if (this.timerRunning) {
this.$store.commit("incremental/add",
{key: "energy", value: this.addIncrement}
)
}
},
toggletimer() {
this.timerRunning = !(this.timerRunning)
}
}
2022-01-04 22:41:36 +00:00
}
</script>
<style scoped>
button {
background-color: #42b983;
2022-01-04 22:41:36 +00:00
}
</style>