refactor: use separate seed for reroll of vegetables

This commit is contained in:
2025-11-05 09:11:59 +01:00
parent 4dca72c57d
commit 8b3b026aea
3 changed files with 7 additions and 6 deletions
+1
View File
@@ -25,6 +25,7 @@ export default [
"max-statements": ["warn", 50],
"max-params": ["warn", 5],
"max-lines": "off",
"init-declarations": "off",
},
},
{
+3 -3
View File
@@ -75,8 +75,8 @@
<td><label for="candidates">Candidates:</label></td>
<td><textarea v-model="config.candidates" id="candidates" rows="8"></textarea></td>
<td>
<button @click="newVegetables"><i icon="rotate-ccw"></i></button>
<br/>
<button @click="newVegetables"><i icon="dices"></i></button>
<br />
<span v-if="candidates.length <= 2" title="not enough candidates">
<i icon="triangle-alert"></i> <i icon="users-round"></i> {{candidates.length}}
</span>
@@ -124,4 +124,4 @@
</main>
</body>
</html>
</html>
+3 -3
View File
@@ -103,6 +103,7 @@ class TableGenerator {
return scores;
}
// eslint-disable-next-line class-methods-use-this
mixKey(index1, index2) {
return Math.min(index1, index2) * 1000 + Math.max(index1, index2);
}
@@ -312,7 +313,7 @@ const app = createApp({
},
newVegetables() {
this.config.candidates = utils
.shuffleSeeded(Object.keys(VEGETABLES), this.config.seed)
.shuffleSeeded(Object.keys(VEGETABLES), utils.randomSeed())
.map((key) => `${key} ${VEGETABLES[key]}`)
.slice(0, 6)
.join("\n");
@@ -374,8 +375,7 @@ const app = createApp({
try {
await navigator.clipboard.writeText(csvTable);
this.copyTableOverride = "Table Copied";
} catch (error) {
console.error(error.message);
} catch {
this.copyTableOverride = "Error";
}
setTimeout(() => {