From: Benjamin Auder Date: Wed, 4 Mar 2020 15:56:03 +0000 (+0100) Subject: Allow to set also randomness against computer X-Git-Url: https://git.auder.net/variants/current/doc/css/vendor/R.css?a=commitdiff_plain;h=f35b9960e1c527fc400ebac85321bd4712459da3;p=vchess.git Allow to set also randomness against computer --- 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"] }}