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:
f1cb85f
)
Fix some typos and forgotten things
author
Benjamin Auder
<benjamin.auder@somewhere>
Wed, 19 Dec 2018 20:18:16 +0000
(21:18 +0100)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Wed, 19 Dec 2018 20:18:16 +0000
(21:18 +0100)
public/javascripts/components/game.js
patch
|
blob
|
blame
|
history
public/javascripts/variants/Antiking.js
patch
|
blob
|
blame
|
history
public/javascripts/variants/Crazyhouse.js
patch
|
blob
|
blame
|
history
public/javascripts/variants/Grand.js
patch
|
blob
|
blame
|
history
public/javascripts/variants/Magnetic.js
patch
|
blob
|
blame
|
history
public/javascripts/variants/Zen.js
patch
|
blob
|
blame
|
history
diff --git
a/public/javascripts/components/game.js
b/public/javascripts/components/game.js
index
e229cdf
..
a17876d
100644
(file)
--- a/
public/javascripts/components/game.js
+++ b/
public/javascripts/components/game.js
@@
-1316,7
+1316,8
@@
Vue.component('my-game', {
const storageVariant = localStorage.getItem("comp-variant");
if (!!storageVariant)
{
const storageVariant = localStorage.getItem("comp-variant");
if (!!storageVariant)
{
- if (storageVariant !== variant)
+ const score = localStorage.getItem("comp-score");
+ if (storageVariant !== variant && score == "*")
{
if (!confirm("Unfinished " + storageVariant +
" computer game will be erased"))
{
if (!confirm("Unfinished " + storageVariant +
" computer game will be erased"))
@@
-1324,12
+1325,8
@@
Vue.component('my-game', {
return;
}
}
return;
}
}
- else
- {
- const score = localStorage.getItem("comp-score");
- if (score == "*")
- return this.continueGame("computer");
- }
+ else if (score == "*")
+ return this.continueGame("computer");
}
}
this.vr = new VariantRules(fen, []);
}
}
this.vr = new VariantRules(fen, []);
diff --git
a/public/javascripts/variants/Antiking.js
b/public/javascripts/variants/Antiking.js
index
0d34271
..
e4d402c
100644
(file)
--- a/
public/javascripts/variants/Antiking.js
+++ b/
public/javascripts/variants/Antiking.js
@@
-201,7
+201,7
@@
class AntikingRules extends ChessRules
return pieces["b"].join("") + "/" + ranks23_black +
"/8/8/" +
ranks23_white + "/" + pieces["w"].join("").toUpperCase() +
return pieces["b"].join("") + "/" + ranks23_black +
"/8/8/" +
ranks23_white + "/" + pieces["w"].join("").toUpperCase() +
- " w 1111";
+ " w 1111
-
";
}
}
}
}
diff --git
a/public/javascripts/variants/Crazyhouse.js
b/public/javascripts/variants/Crazyhouse.js
index
afebcc3
..
1fff1e9
100644
(file)
--- a/
public/javascripts/variants/Crazyhouse.js
+++ b/
public/javascripts/variants/Crazyhouse.js
@@
-24,10
+24,21
@@
class CrazyhouseRules extends ChessRules
return true;
}
return true;
}
+ static ParseFen(fen)
+ {
+ const fenParts = fen.split(" ");
+ return Object.assign(
+ ChessRules.ParseFen(fen),
+ {
+ reserve: fenParts[4],
+ promoted: fenParts[5],
+ }
+ );
+ }
+
static GenRandInitFen()
{
static GenRandInitFen()
{
- const fen = ChessRules.GenRandInitFen();
- return fen.replace(" w 1111", " w 1111 0000000000 -");
+ return ChessRules.GenRandInitFen() + " 0000000000 -";
}
getFen()
}
getFen()
@@
-59,6
+70,8
@@
class CrazyhouseRules extends ChessRules
}
if (res.length > 0)
res = res.slice(0,-1); //remove last comma
}
if (res.length > 0)
res = res.slice(0,-1); //remove last comma
+ else
+ res = "-";
return res;
}
return res;
}
@@
-87,10
+100,13
@@
class CrazyhouseRules extends ChessRules
}
};
this.promoted = doubleArray(V.size.x, V.size.y, false);
}
};
this.promoted = doubleArray(V.size.x, V.size.y, false);
-
for (let square of fenParsd.promoted.split(",")
)
+
if (fenParsed.promoted != "-"
)
{
{
- const [x,y] = V.SquareToCoords(square);
- promoted[x][y] = true;
+ for (let square of fenParsed.promoted.split(","))
+ {
+ const [x,y] = V.SquareToCoords(square);
+ promoted[x][y] = true;
+ }
}
}
}
}
diff --git
a/public/javascripts/variants/Grand.js
b/public/javascripts/variants/Grand.js
index
ec2afd8
..
22b2494
100644
(file)
--- a/
public/javascripts/variants/Grand.js
+++ b/
public/javascripts/variants/Grand.js
@@
-18,10
+18,18
@@
class GrandRules extends ChessRules
return true;
}
return true;
}
+ static ParseFen(fen)
+ {
+ const fenParts = fen.split(" ");
+ return Object.assign(
+ ChessRules.ParseFen(fen),
+ { captured: fenParts[4] }
+ );
+ }
+
static GenRandInitFen()
{
static GenRandInitFen()
{
- const fen = ChessRules.GenRandInitFen();
- return fen.replace(" w 1111", " w 1111 0000000000");
+ return ChessRules.GenRandInitFen() + " 0000000000";
}
getFen()
}
getFen()
diff --git
a/public/javascripts/variants/Magnetic.js
b/public/javascripts/variants/Magnetic.js
index
17efeaa
..
6682b27
100644
(file)
--- a/
public/javascripts/variants/Magnetic.js
+++ b/
public/javascripts/variants/Magnetic.js
@@
-1,6
+1,6
@@
class MagneticRules extends ChessRules
{
class MagneticRules extends ChessRules
{
- static get HasEnpassant { return false; }
+ static get HasEnpassant
()
{ return false; }
setOtherVariables(fen)
{
setOtherVariables(fen)
{
diff --git
a/public/javascripts/variants/Zen.js
b/public/javascripts/variants/Zen.js
index
b090a29
..
66cd61f
100644
(file)
--- a/
public/javascripts/variants/Zen.js
+++ b/
public/javascripts/variants/Zen.js
@@
-1,7
+1,7
@@
class ZenRules extends ChessRules
{
// NOTE: enPassant, if enabled, would need to redefine carefully getEpSquare
class ZenRules extends ChessRules
{
// NOTE: enPassant, if enabled, would need to redefine carefully getEpSquare
- static get HasEnpassant { return false; }
+ static get HasEnpassant
()
{ return false; }
// TODO(?): some duplicated code in 2 next functions
getSlideNJumpMoves([x,y], steps, oneStep)
// TODO(?): some duplicated code in 2 next functions
getSlideNJumpMoves([x,y], steps, oneStep)