Skip to content
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
8 changes: 4 additions & 4 deletions lichess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ export default function processGame(game: Game, username: string, settings: Sett

const chess = new Chess(undefined, { skipValidation: true });
chess.loadPgn(game.pgn);
const turn = chess.turn();
while (chess.moveNumber() > 1 && (chess.moveNumber() - 1) * 2 + Number(turn === 'b') > plyOfInterest) {
while (chess.moveNumber() > 1
&& (chess.moveNumber() - 1) * 2 + Number(chess.turn() === 'b') > plyOfInterest) {
chess.undo();
}

const board = chess.board();
if (turn === 'b') {
if (chess.turn() === 'b') {
board.reverse();
board.map(row => row.reverse());
}
Expand All @@ -205,7 +205,7 @@ export default function processGame(game: Game, username: string, settings: Sett
board: {
grid: board,
ply: plyOfInterest - 1,
turn,
turn: chess.turn(),
},
analysis: game.analysis?.map(entry => ({
eval: entry.eval,
Expand Down
2 changes: 1 addition & 1 deletion pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function Document() {
<meta property="og:site_name" content="Me Chess Book" />
<meta property="og:locale" content="en_GB" />
<meta property="article:author" content="Paul Happy Hutchinson" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta httpEquiv="x-ua-compatible" content="ie=edge" />
<meta name="msapplication-config" content="/browserconfig.xml" />
</Head>
<body className="bg-gray-200 print:bg-none">
Expand Down