projects
/
vchess.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
270968d
)
Fix magnetic promotions, attempt to fix Alice chess
author
Benjamin Auder
<benjamin.auder@somewhere>
Fri, 23 Nov 2018 12:09:51 +0000
(13:09 +0100)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Fri, 23 Nov 2018 12:09:51 +0000
(13:09 +0100)
public/javascripts/components/game.js
patch
|
blob
|
blame
|
history
public/javascripts/variants/Alice.js
patch
|
blob
|
blame
|
history
public/javascripts/variants/Magnetic.js
patch
|
blob
|
blame
|
history
diff --git
a/public/javascripts/components/game.js
b/public/javascripts/components/game.js
index
e3cc6af
..
ca8a6bf
100644
(file)
--- a/
public/javascripts/components/game.js
+++ b/
public/javascripts/components/game.js
@@
-574,7
+574,7
@@
Vue.component('my-game', {
this.newGame("computer");
},
newGame: function(mode, fenInit, color, oppId, moves, continuation) {
this.newGame("computer");
},
newGame: function(mode, fenInit, color, oppId, moves, continuation) {
- const fen = fenInit || VariantRules.GenRandInitFen();
+ const fen =
"pppppppp/rnbqkbnr/8/8/8/8/PPPPPPPP/ROBQKBOR 1111"; //
fenInit || VariantRules.GenRandInitFen();
console.log(fen); //DEBUG
this.score = "*";
if (mode=="human" && !oppId)
console.log(fen); //DEBUG
this.score = "*";
if (mode=="human" && !oppId)
diff --git
a/public/javascripts/variants/Alice.js
b/public/javascripts/variants/Alice.js
index
3cba8d0
..
1e1ce46
100644
(file)
--- a/
public/javascripts/variants/Alice.js
+++ b/
public/javascripts/variants/Alice.js
@@
-76,12
+76,15
@@
class AliceRules extends ChessRules
return false;
}
}
return false;
}
}
- m.appear.forEach(psq => {
- if (Object.keys(VariantRules.ALICE_CODES).includes(psq.p))
+ // If the move is computed on board1, m.appear change for Alice pieces.
+ if (mirrorSide==1)
+ {
+ m.appear.forEach(psq => { //forEach: castling taken into account
psq.p = VariantRules.ALICE_CODES[psq.p]; //goto board2
psq.p = VariantRules.ALICE_CODES[psq.p]; //goto board2
- else
- psq.p = VariantRules.ALICE_PIECES[psq.p]; //goto board1
- });
+ });
+ }
+ else //move on board2: mark vanishing piece as Alice
+ m.vanish[0].p = VariantRules.ALICE_CODES[m.vanish[0].p]
return true;
});
}
return true;
});
}
diff --git
a/public/javascripts/variants/Magnetic.js
b/public/javascripts/variants/Magnetic.js
index
7fecf78
..
d1436c0
100644
(file)
--- a/
public/javascripts/variants/Magnetic.js
+++ b/
public/javascripts/variants/Magnetic.js
@@
-112,7
+112,7
@@
class MagneticRules extends ChessRules
// Scan move for pawn (max 1) on 8th rank
for (let i=1; i<move.appear.length; i++)
{
// Scan move for pawn (max 1) on 8th rank
for (let i=1; i<move.appear.length; i++)
{
- if (move.appear[i].p==V.PAWN && move.appear[i].x==lastRank)
+ if (move.appear[i].p==V.PAWN && move.appear[i].
c==color && move.appear[i].
x==lastRank)
{
move.appear[i].p = V.ROOK;
moves.push(move);
{
move.appear[i].p = V.ROOK;
moves.push(move);