From f35b9960e1c527fc400ebac85321bd4712459da3 Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Wed, 4 Mar 2020 16:56:03 +0100 Subject: [PATCH] Allow to set also randomness against computer --- client/src/base_rules.js | 1 - client/src/components/ComputerGame.vue | 2 +- client/src/components/Settings.vue | 8 ++- client/src/store.js | 6 +- client/src/translations/en.js | 1 + client/src/translations/es.js | 1 + client/src/translations/fr.js | 1 + client/src/variants/Antiking.js | 1 - client/src/variants/Baroque.js | 1 - client/src/variants/Circular.js | 1 - client/src/variants/Grand.js | 1 - client/src/variants/Losers.js | 1 - client/src/variants/Rifle.js | 78 ++++++++++++++++++++++++-- client/src/variants/Royalrace.js | 1 - client/src/variants/Upsidedown.js | 1 - client/src/views/Rules.vue | 2 +- 16 files changed, 90 insertions(+), 17 deletions(-) diff --git a/client/src/base_rules.js b/client/src/base_rules.js index 93772b9b..d2b8a7fd 100644 --- a/client/src/base_rules.js +++ b/client/src/base_rules.js @@ -240,7 +240,6 @@ export const ChessRules = class ChessRules { // Setup the initial random (asymmetric) position static GenRandInitFen(randomness) { - if (!randomness) randomness = 2; if (randomness == 0) // Deterministic: return "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w 0 1111 -"; diff --git a/client/src/components/ComputerGame.vue b/client/src/components/ComputerGame.vue index 9699c5a8..5782ba6a 100644 --- a/client/src/components/ComputerGame.vue +++ b/client/src/components/ComputerGame.vue @@ -58,7 +58,7 @@ export default { if (!game) { game = { vname: this.gameInfo.vname, - fenStart: V.GenRandInitFen(), + fenStart: V.GenRandInitFen(this.st.settings.randomness), moves: [] }; game.fen = game.fenStart; diff --git a/client/src/components/Settings.vue b/client/src/components/Settings.vue index 6e623ba4..6adf9b0b 100644 --- a/client/src/components/Settings.vue +++ b/client/src/components/Settings.vue @@ -52,6 +52,12 @@ div type="checkbox" v-model="st.settings.sound" ) + fieldset + label(for="setRandomness") {{ st.tr["Randomness against computer"] }} + select#setRandomness(v-model="st.settings.randomness") + option(value="0") {{ st.tr["Deterministic"] }} + option(value="1") {{ st.tr["Symmetric random"] }} + option(value="2") {{ st.tr["Asymmetric random"] }}