projects
/
xogo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Attempt to fix README.md for gitweb parser
[xogo.git]
/
base_rules.js
diff --git
a/base_rules.js
b/base_rules.js
index
cdce2a1
..
f9913c4
100644
(file)
--- a/
base_rules.js
+++ b/
base_rules.js
@@
-219,12
+219,15
@@
export default class ChessRules {
const s = FenUtil.setupPieces(
['r', 'n', 'b', 'q', 'k', 'b', 'n', 'r'],
{
const s = FenUtil.setupPieces(
['r', 'n', 'b', 'q', 'k', 'b', 'n', 'r'],
{
+ randomness: this.options["randomness"],
between: {p1: 'k', p2: 'r'},
between: {p1: 'k', p2: 'r'},
- diffCol: ['b']
+ diffCol: ['b'],
+ flags: ['r']
}
);
return {
}
);
return {
- fen: s.b + "/pppppppp/8/8/8/8/PPPPPPPP/" + s.w,
+ fen: s.b.join("") + "/pppppppp/8/8/8/8/PPPPPPPP/" +
+ s.w.join("").toUpperCase(),
o: {flags: s.flags}
};
}
o: {flags: s.flags}
};
}
@@
-283,9
+286,9
@@
export default class ChessRules {
// Position part of the FEN string
getPosition() {
let position = "";
// Position part of the FEN string
getPosition() {
let position = "";
- for (let i = 0; i < this.size.
y
; i++) {
+ for (let i = 0; i < this.size.
x
; i++) {
let emptyCount = 0;
let emptyCount = 0;
- for (let j = 0; j < this.size.
x
; j++) {
+ for (let j = 0; j < this.size.
y
; j++) {
if (this.board[i][j] == "")
emptyCount++;
else {
if (this.board[i][j] == "")
emptyCount++;
else {
@@
-300,7
+303,7
@@
export default class ChessRules {
if (emptyCount > 0)
// "Flush remainder"
position += C.FenEmptySquares(emptyCount);
if (emptyCount > 0)
// "Flush remainder"
position += C.FenEmptySquares(emptyCount);
- if (i < this.size.
y
- 1)
+ if (i < this.size.
x
- 1)
position += "/"; //separate rows
}
return position;
position += "/"; //separate rows
}
return position;
@@
-356,9
+359,6
@@
export default class ChessRules {
if (this.options[opt.variable] === undefined)
this.options[opt.variable] = opt.defaut;
});
if (this.options[opt.variable] === undefined)
this.options[opt.variable] = opt.defaut;
});
- if (o.genFenOnly)
- // This object will be used only for initial FEN generation
- return;
// Some variables
this.playerColor = o.color;
// Some variables
this.playerColor = o.color;
@@
-557,7
+557,7
@@
export default class ChessRules {
chessboard.style.top = spaceTop + "px";
// Give sizes instead of recomputing them,
// because chessboard might not be drawn yet.
chessboard.style.top = spaceTop + "px";
// Give sizes instead of recomputing them,
// because chessboard might not be drawn yet.
- this.setupPieces({
+ this.setup
Visual
Pieces({
width: cbWidth,
height: cbHeight,
x: spaceLeft,
width: cbWidth,
height: cbHeight,
x: spaceLeft,
@@
-597,7
+597,7
@@
export default class ChessRules {
return board;
}
return board;
}
- setupPieces(r) {
+ setup
Visual
Pieces(r) {
let chessboard =
document.getElementById(this.containerId).querySelector(".chessboard");
if (!r)
let chessboard =
document.getElementById(this.containerId).querySelector(".chessboard");
if (!r)
@@
-965,7
+965,7
@@
export default class ChessRules {
// TODO: onpointerdown/move/up ? See reveal.js /controllers/touch.js
}
// TODO: onpointerdown/move/up ? See reveal.js /controllers/touch.js
}
- // NOTE: not called if isDiagram
, or genFenOnly
+ // NOTE: not called if isDiagram
removeListeners() {
let container = document.getElementById(this.containerId);
this.windowResizeObs.unobserve(container);
removeListeners() {
let container = document.getElementById(this.containerId);
this.windowResizeObs.unobserve(container);
@@
-2641,6
+2641,7
@@
export default class ChessRules {
let container = document.getElementById(this.containerId);
if (document.hidden) {
document.onvisibilitychange = () => {
let container = document.getElementById(this.containerId);
if (document.hidden) {
document.onvisibilitychange = () => {
+ // TODO here: page reload ?! (some issues if tab changed...)
document.onvisibilitychange = undefined;
checkDisplayThenAnimate(700);
};
document.onvisibilitychange = undefined;
checkDisplayThenAnimate(700);
};