projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Eightpieces almost ready
[vchess.git]
/
client
/
src
/
variants
/
Atomic.js
diff --git
a/client/src/variants/Atomic.js
b/client/src/variants/Atomic.js
index
996f2d1
..
fdc665d
100644
(file)
--- a/
client/src/variants/Atomic.js
+++ b/
client/src/variants/Atomic.js
@@
-1,14
+1,21
@@
import { ChessRules, PiPo } from "@/base_rules";
export const VariantRules = class AtomicRules extends ChessRules {
import { ChessRules, PiPo } from "@/base_rules";
export const VariantRules = class AtomicRules extends ChessRules {
+ getEpSquare(moveOrSquare) {
+ if (typeof moveOrSquare !== "object" || moveOrSquare.appear.length > 0)
+ return super.getEpSquare(moveOrSquare);
+ // Capturing move: no en-passant
+ return undefined;
+ }
+
getPotentialMovesFrom([x, y]) {
let moves = super.getPotentialMovesFrom([x, y]);
// Handle explosions
moves.forEach(m => {
getPotentialMovesFrom([x, y]) {
let moves = super.getPotentialMovesFrom([x, y]);
// Handle explosions
moves.forEach(m => {
+ // NOTE: if vanish.length==2 and appear.length==2, this is castle
if (m.vanish.length > 1 && m.appear.length <= 1) {
if (m.vanish.length > 1 && m.appear.length <= 1) {
- //avoid castles
- // Explosion! OPTION (TODO?): drop moves which explode our king here
+ // Explosion! (TODO?: drop moves which explode our king here)
let steps = [
[-1, -1],
[-1, 0],
let steps = [
[-1, -1],
[-1, 0],
@@
-76,7
+83,7
@@
export const VariantRules = class AtomicRules extends ChessRules {
updateVariables(move) {
super.updateVariables(move);
if (move.appear.length == 0) {
updateVariables(move) {
super.updateVariables(move);
if (move.appear.length == 0) {
- //
c
apture
+ //
C
apture
const firstRank = { w: 7, b: 0 };
for (let c of ["w", "b"]) {
// Did we explode king of color c ? (TODO: remove move earlier)
const firstRank = { w: 7, b: 0 };
for (let c of ["w", "b"]) {
// Did we explode king of color c ? (TODO: remove move earlier)
@@
-143,10
+150,9
@@
export const VariantRules = class AtomicRules extends ChessRules {
const color = this.turn;
const kp = this.kingPos[color];
if (kp[0] < 0)
const color = this.turn;
const kp = this.kingPos[color];
if (kp[0] < 0)
- //
k
ing disappeared
+ //
K
ing disappeared
return color == "w" ? "0-1" : "1-0";
if (this.atLeastOneMove())
return color == "w" ? "0-1" : "1-0";
if (this.atLeastOneMove())
- // game not over
return "*";
if (!this.isAttacked(kp, [V.GetOppCol(color)])) return "1/2";
return color == "w" ? "0-1" : "1-0"; //checkmate
return "*";
if (!this.isAttacked(kp, [V.GetOppCol(color)])) return "1/2";
return color == "w" ? "0-1" : "1-0"; //checkmate