Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analysis fix on wall gating #56

Merged
merged 2 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions public/advanced.html
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@
transform: translateX(-50%);
font-size: 28px;
font-weight: bold;
font-family: "Times New Roman", Georgia, Serif, Arial;
}

spangameresult {
Expand Down
56 changes: 51 additions & 5 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,11 +377,24 @@ function parseUCIMove(ucimove) {
throw TypeError;
}
let move = ucimove;
let gatingmove = "";
if (move.includes(",")) {
let gating = move.split(",")[1];
move = move.split(",")[0];
gatingmove =
gating.split(/[0-9]+/).filter(function (item) {
return item != null && item != undefined && item != "";
})[1] +
gating.split(/[a-z]+/).filter(function (item) {
return item != null && item != undefined && item != "";
})[1];
}
if (move.includes("@")) {
return [
move.slice(0, move.indexOf("@") + 1),
move.slice(move.indexOf("@") + 1),
"",
gatingmove,
];
}
let additional = "";
Expand All @@ -407,7 +420,7 @@ function parseUCIMove(ucimove) {
if (ranks.length != 2) {
throw RangeError;
}
return [files[0] + ranks[0], files[1] + ranks[1], additional];
return [files[0] + ranks[0], files[1] + ranks[1], additional, gatingmove];
}

function showWallSquares() {
Expand Down Expand Up @@ -1009,9 +1022,9 @@ new Module().then((loadedModule) => {
} else {
evaluation = multipvrecord[bestpv][1];
if (evaluation > 0) {
evalscore.innerText = "+" + evaluation.toString();
evalscore.innerText = "+" + evaluation.toFixed(2).toString();
} else {
evalscore.innerText = evaluation;
evalscore.innerText = evaluation.toFixed(2);
}
if (evaluation < -9.8) {
evaluationBar.style.width = "1%";
Expand All @@ -1029,7 +1042,8 @@ new Module().then((loadedModule) => {
if (
bestmove[0] != undefined &&
bestmove[1] != undefined &&
bestmove[2] != undefined
bestmove[2] != undefined &&
bestmove[3] != undefined
) {
if (bestmove[0].includes("@")) {
autoshapes.push({
Expand Down Expand Up @@ -1150,11 +1164,29 @@ new Module().then((loadedModule) => {
}
}
}
if (bestmove[3] != "") {
autoshapes.push({
brush: "blue",
orig: bestmove[3].replace("10", ":"),
});
autoshapes.push({
brush: "blue",
dest: "a0",
orig: bestmove[3].replace("10", ":"),
piece: {
color: "black",
role: "_-piece",
scale: 0.7,
},
modifiers: { hilite: true },
});
}
}
if (
ponder[0] != undefined &&
ponder[1] != undefined &&
ponder[2] != undefined
ponder[2] != undefined &&
ponder[3] != undefined
) {
if (ponder[0].includes("@")) {
autoshapes.push({ brush: "red", orig: ponder[1].replace("10", ":") });
Expand Down Expand Up @@ -1272,6 +1304,20 @@ new Module().then((loadedModule) => {
}
}
}
if (ponder[3] != "") {
autoshapes.push({ brush: "red", orig: ponder[3].replace("10", ":") });
autoshapes.push({
brush: "red",
dest: "a0",
orig: ponder[3].replace("10", ":"),
piece: {
color: "black",
role: "_-piece",
scale: 0.7,
},
modifiers: { hilite: true },
});
}
}
chessground.setAutoShapes(autoshapes);
};
Expand Down
Loading