projects
/
vchess.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
658c47b
)
Fix some variants and improve a few other things a little bit
author
Benjamin Auder
<benjamin.auder@somewhere>
Tue, 3 Mar 2020 14:56:42 +0000
(15:56 +0100)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Tue, 3 Mar 2020 14:56:42 +0000
(15:56 +0100)
client/src/components/ComputerGame.vue
patch
|
blob
|
blame
|
history
client/src/components/ContactForm.vue
patch
|
blob
|
blame
|
history
client/src/variants/Allmate.js
patch
|
blob
|
blame
|
history
client/src/variants/Baroque.js
patch
|
blob
|
blame
|
history
client/src/variants/Knightrelay.js
patch
|
blob
|
blame
|
history
diff --git
a/client/src/components/ComputerGame.vue
b/client/src/components/ComputerGame.vue
index
aee1f70
..
9699c5a
100644
(file)
--- a/
client/src/components/ComputerGame.vue
+++ b/
client/src/components/ComputerGame.vue
@@
-38,7
+38,8
@@
export default {
this.compWorker.onmessage = e => {
let compMove = e.data;
// Small delay for the bot to appear "more human"
this.compWorker.onmessage = e => {
let compMove = e.data;
// Small delay for the bot to appear "more human"
- const delay = Math.max(500 - (Date.now() - this.timeStart), 0);
+ const minDelay = this.gameInfo.mode == "versus" ? 500 : 1000;
+ const delay = Math.max(minDelay - (Date.now() - this.timeStart), 0);
let self = this;
setTimeout(() => {
if (this.currentUrl != document.location.href) return; //page change
let self = this;
setTimeout(() => {
if (this.currentUrl != document.location.href) return; //page change
diff --git
a/client/src/components/ContactForm.vue
b/client/src/components/ContactForm.vue
index
cadbf73
..
f9c5c60
100644
(file)
--- a/
client/src/components/ContactForm.vue
+++ b/
client/src/components/ContactForm.vue
@@
-12,7
+12,7
@@
div
label.modal-close(for="modalContact")
fieldset
label(for="userEmail") {{ st.tr["Email"] }}
label.modal-close(for="modalContact")
fieldset
label(for="userEmail") {{ st.tr["Email"] }}
- input#userEmail(type="email")
+ input#userEmail(type="email"
:value="st.user.email"
)
fieldset
label(for="mailSubject") {{ st.tr["Subject"] }}
input#mailSubject(type="text")
fieldset
label(for="mailSubject") {{ st.tr["Subject"] }}
input#mailSubject(type="text")
diff --git
a/client/src/variants/Allmate.js
b/client/src/variants/Allmate.js
index
5636f56
..
728de25
100644
(file)
--- a/
client/src/variants/Allmate.js
+++ b/
client/src/variants/Allmate.js
@@
-5,10
+5,6
@@
export const VariantRules = class AllmateRules extends ChessRules {
return false;
}
return false;
}
- canTake(sq1, sq2) {
- return false; //Captures handled differently
- }
-
getCheckSquares() {
// No notion of check
return [];
getCheckSquares() {
// No notion of check
return [];
@@
-20,6
+16,10
@@
export const VariantRules = class AllmateRules extends ChessRules {
getPotentialMovesFrom([x, y]) {
let moves = super.getPotentialMovesFrom([x, y]);
getPotentialMovesFrom([x, y]) {
let moves = super.getPotentialMovesFrom([x, y]);
+ // Remove standard captures (without removing castling):
+ moves = moves.filter(m => {
+ return m.vanish.length == 1 || m.appear.length == 2;
+ });
// Augment moves with "mate-captures":
// TODO: this is coded in a highly inefficient way...
// Augment moves with "mate-captures":
// TODO: this is coded in a highly inefficient way...
diff --git
a/client/src/variants/Baroque.js
b/client/src/variants/Baroque.js
index
8f1f9ba
..
ae4b511
100644
(file)
--- a/
client/src/variants/Baroque.js
+++ b/
client/src/variants/Baroque.js
@@
-72,7
+72,7
@@
export const VariantRules = class BaroqueRules extends ChessRules {
) {
const oppPiece = this.getPiece(i, j);
if (oppPiece == V.IMMOBILIZER) {
) {
const oppPiece = this.getPiece(i, j);
if (oppPiece == V.IMMOBILIZER) {
- // Moving is
impossible only if this immobilizer is not
neutralized
+ // Moving is
possible only if this immobilizer is
neutralized
for (let step2 of adjacentSteps) {
const [i2, j2] = [i + step2[0], j + step2[1]];
if (i2 == x && j2 == y) continue; //skip initial piece!
for (let step2 of adjacentSteps) {
const [i2, j2] = [i + step2[0], j + step2[1]];
if (i2 == x && j2 == y) continue; //skip initial piece!
@@
-474,8
+474,8
@@
export const VariantRules = class BaroqueRules extends ChessRules {
}
isAttackedByBishop([x, y], colors) {
}
isAttackedByBishop([x, y], colors) {
- // We cheat a little here: since this function is used exclusively for
king,
- // it's enough to check the immediate surrounding of the square.
+ // We cheat a little here: since this function is used exclusively for
+ //
the king,
it's enough to check the immediate surrounding of the square.
const adjacentSteps = V.steps[V.ROOK].concat(V.steps[V.BISHOP]);
for (let step of adjacentSteps) {
const [i, j] = [x + step[0], y + step[1]];
const adjacentSteps = V.steps[V.ROOK].concat(V.steps[V.BISHOP]);
for (let step of adjacentSteps) {
const [i, j] = [x + step[0], y + step[1]];
@@
-512,6
+512,23
@@
export const VariantRules = class BaroqueRules extends ChessRules {
return false;
}
return false;
}
+ isAttackedByKing([x, y], colors) {
+ const steps = V.steps[V.ROOK].concat(V.steps[V.BISHOP]);
+ for (let step of steps) {
+ let rx = x + step[0],
+ ry = y + step[1];
+ if (
+ V.OnBoard(rx, ry) &&
+ this.getPiece(rx, ry) === V.KING &&
+ colors.includes(this.getColor(rx, ry)) &&
+ !this.isImmobilized([rx, ry])
+ ) {
+ return true;
+ }
+ }
+ return false;
+ }
+
static get VALUES() {
return {
p: 1,
static get VALUES() {
return {
p: 1,
diff --git
a/client/src/variants/Knightrelay.js
b/client/src/variants/Knightrelay.js
index
eebb0f2
..
de1e89a
100644
(file)
--- a/
client/src/variants/Knightrelay.js
+++ b/
client/src/variants/Knightrelay.js
@@
-29,7
+29,7
@@
export const VariantRules = class KnightrelayRules extends ChessRules {
// Potential promotions:
const finalPieces = piece == V.PAWN && x + step[0] == lastRank
? [V.ROOK, V.KNIGHT, V.BISHOP, V.QUEEN]
// Potential promotions:
const finalPieces = piece == V.PAWN && x + step[0] == lastRank
? [V.ROOK, V.KNIGHT, V.BISHOP, V.QUEEN]
- : [
V.PAWN
];
+ : [
piece
];
for (let p of finalPieces) {
moves.push(
this.getBasicMove([x,y], [x+step[0],y+step[1]], {
for (let p of finalPieces) {
moves.push(
this.getBasicMove([x,y], [x+step[0],y+step[1]], {