FanucWeb/ActiveBOWeb/src/store/PolicyStore.js
2023-02-28 19:33:48 +01:00

35 lines
902 B
JavaScript

import { defineStore } from "pinia";
export const usePStore = defineStore('Policy Store', {
state: () => {
return {
policy: Array(10).fill(0),
nr_weights: 5,
weights: [0, 0, 0, 0, 0],
max_steps: 10,
}
},
getters: {
getPolicy: (state) => state.policy,
getNrWeights: (state) => state.nr_weights,
getWeights: (state) => state.weights,
getMaxSteps: (state) => state.max_steps,
},
actions: {
setPolicy(value) {
this.policy = null;
this.policy = value;
},
setNrWeights(value) {
this.nr_weights = value;
this.weights = Array(this.nr_weights).fill(0);
},
setWeights(value) {
this.weights = value;
},
setMaxSteps(value) {
this.max_steps = value;
},
}
})