if (position.length == 0) return false;
const rows = position.split("/");
if (rows.length != V.size.x) return false;
+ let kings = {};
for (let row of rows) {
let sumElts = 0;
for (let i = 0; i < row.length; i++) {
+ if (['K','k'].includes(row[i]))
+ kings[row[i]] = true;
if (V.PIECES.includes(row[i].toLowerCase())) sumElts++;
else {
const num = parseInt(row[i]);
}
if (sumElts != V.size.y) return false;
}
+ // Both kings should be on board:
+ if (Object.keys(kings).length != 2)
+ return false;
return true;
}
"My problems": "My problems",
"Name: alphanumerics and underscore": "Name: alphanumerics and underscore",
"Name or Email": "Name or Email",
+ Next: "Next",
"New connexion detected: tab now offline": "New connexion detected: tab now offline",
"New correspondance game:": "New correspondance game:",
"New game": "New game",
"New problem": "New problem",
News: "News",
+ "No more problems": "No more problems",
"No subject. Send anyway?": "No subject. Send anyway?",
None: "None",
"Notifications by email": "Notifications by email",
"Please select a variant": "Please select a variant",
Practice: "Practice",
"Prefix?": "Prefix?",
+ Previous: "Previous",
"Processing... Please wait": "Processing... Please wait",
Problems: "Problems",
"participant(s):": "participant(s):",
"My problems": "Mis problemas",
"Name: alphanumerics and underscore": "Nombre: alfanuméricos y underscore",
"Name or Email": "Nombre o Email",
+ Next: "Próximo",
"New connexion detected: tab now offline": "Nueva conexión detectada: pestaña ahora desconectada",
"New correspondance game:": "Nueva partida por correspondencia:",
"New game": "Nueva partida",
"New problem": "Nuevo problema",
News: "Noticias",
+ "No more problems": "No mas problemas",
"No subject. Send anyway?": "Sin asunto. ¿Enviar sin embargo?",
None: "Ninguno",
"Notifications by email": "Notificaciones por email",
"Please select a variant": "Por favor seleccione una variante",
Practice: "Práctica",
"Prefix?": "¿Prefijo?",
+ Previous: "Anterior",
"Processing... Please wait": "Procesando... por favor espere",
Problems: "Problemas",
"participant(s):": "participante(s):",
"My problems": "Mes problèmes",
"Name: alphanumerics and underscore": "Nom: alphanumériques et underscore",
"Name or Email": "Nom ou Email",
+ Next: "Suivant",
"New connexion detected: tab now offline": "Nouvelle connexion détectée : onglet désormais hors ligne",
"New correspondance game:": "Nouvelle partie par corespondance :",
"New game": "Nouvelle partie",
"New problem": "Nouveau problème",
News: "Nouvelles",
+ "No more problems": "Plus de problèmes",
"No subject. Send anyway?": "Pas de sujet. Envoyer quand-même ??",
None: "Aucun",
"Notifications by email": "Notifications par email",
"Please select a variant": "Sélectionnez une variante SVP",
Practice: "Pratiquer",
"Prefix?": "Préfixe ?",
+ Previous: "Précédent",
"Processing... Please wait": "Traitement en cours... Attendez SVP",
Problems: "Problèmes",
"participant(s):": "participant(s) :",
import { ChessRules } from "@/base_rules";
export const VariantRules = class ExtinctionRules extends ChessRules {
+ static IsGoodPosition(position) {
+ if (!ChessRules.IsGoodPosition(position))
+ return false;
+ // Also check that each piece type is present
+ const rows = position.split("/");
+ let pieces = {};
+ for (let row of rows) {
+ for (let i = 0; i < row.length; i++) {
+ if (isNaN(parseInt(row[i])) && !pieces[row[i]])
+ pieces[row[i]] = true;
+ }
+ }
+ if (Object.keys(pieces).length != 12)
+ return false;
+ return true;
+ }
+
setOtherVariables(fen) {
super.setOtherVariables(fen);
const pos = V.ParseFen(fen).position;
.row(v-if="showOne")
.col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
#topPage
+ .button-group(v-if="st.user.id == curproblem.uid")
+ button(@click="editProblem(curproblem)") {{ st.tr["Edit"] }}
+ button(@click="deleteProblem(curproblem)") {{ st.tr["Delete"] }}
span.vname {{ curproblem.vname }}
span.uname ({{ curproblem.uname }})
button.marginleft(@click="backToList()") {{ st.tr["Back to list"] }}
- button.nomargin(
- v-if="st.user.id == curproblem.uid"
- @click="editProblem(curproblem)"
- )
- | {{ st.tr["Edit"] }}
- button.nomargin(
- v-if="st.user.id == curproblem.uid"
- @click="deleteProblem(curproblem)"
- )
- | {{ st.tr["Delete"] }}
+ button.nomargin(@click="gotoPrevNext($event,curproblem,1)")
+ | {{ st.tr["Previous"] }}
+ button.nomargin(@click="gotoPrevNext($event,curproblem,-1)")
+ | {{ st.tr["Next"] }}
p.oneInstructions.clickable(
v-html="parseHtml(curproblem.instruction)"
@click="curproblem.showSolution=!curproblem.showSolution"
this.showOne = true;
});
},
+ gotoPrevNext: function(e, prob, dir) {
+ const startIdx = this.problems.findIndex(p => p.id == prob.id);
+ let nextIdx = startIdx + dir;
+ while (
+ nextIdx >= 0 &&
+ nextIdx < this.problems.length &&
+ ((this.onlyMines && this.problems[nextIdx].uid != this.st.user.id) ||
+ (!this.onlyMines && this.problems[nextIdx].uid == this.st.user.id))
+ )
+ nextIdx += dir;
+ if (nextIdx >= 0 && nextIdx < this.problems.length)
+ this.setHrefPid(this.problems[nextIdx]);
+ else
+ alert(this.st.tr["No more problems"]);
+ },
prepareNewProblem: function() {
this.resetCurProb();
window.doClick("modalNewprob");