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

Add generation timestamp to evals and puzzles #61

Merged
merged 2 commits into from
Oct 16, 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
8 changes: 7 additions & 1 deletion web/index.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
<p>
<a class="primary" href="lichess_db_eval.jsonl.zst">Download lichess_db_eval.jsonl.zst</a>
</p>
<p>
This file was last updated on <!-- dateUpdated -->.
</p>
<h3 id="eval_format">Format</h3>
<p>Evaluations are formatted as JSON; one position per line.</p>
<p>The schema of a position looks like this:</p>
Expand Down Expand Up @@ -121,11 +124,14 @@
<a href="#evals">Evaluations</a>
</nav>
<p>
<strong><!-- nbPuzzles --></strong> chess puzzles, rated and tagged.
<strong><!-- nbPuzzles --></strong> chess puzzles, rated, and tagged.
<a href="https://lichess.org/training/themes">See them in action on Lichess</a>.
<p>
<a class="primary" href="lichess_db_puzzle.csv.zst">Download lichess_db_puzzle.csv.zst</a>
</p>
<p>
This file was last updated on <!-- dateUpdated -->.
</p>
<h3 id="puzzle_format">Format</h3>
<p>Puzzles are formatted as standard CSV. The fields are as follows:</p>
<pre>PuzzleId,FEN,Moves,Rating,RatingDeviation,Popularity,NbPlays,Themes,GameUrl,OpeningTags</pre>
Expand Down
6 changes: 6 additions & 0 deletions web/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const styleFile = 'style.css';
const listFile = 'list.txt';

const clockSince = moment('2017-04');
const today = new Date();

function numberFormat(n) {
return new Intl.NumberFormat().format(n);
Expand Down Expand Up @@ -122,6 +123,10 @@ function replaceNbEvals(template) {
.then(c => template.replace('<!-- nbEvals -->', numberFormat(c)));
}

function replaceDateUpdated(template) {
return template.replace('<!-- dateUpdated -->', today.toLocaleDateString('en-GB'));
}

process.on('unhandledRejection', r => console.log(r));

Promise.all([
Expand All @@ -141,6 +146,7 @@ Promise.all([
.then(rv('threeCheck'))
.then(replaceNbPuzzles)
.then(replaceNbEvals)
.then(replaceDateUpdated)
.then(rendered => {
return fs.writeFile(sourceDir + '/' + indexFile, rendered.replace(/<!-- style -->/, style));
});
Expand Down