Also change 'id' to 'engine' in a long-standing cleanup, and remove the unused author information.
# you probably need specific prior permission to use this.
our $tb_serial_key = undef;
+# Credits to show in the footer.
+our $engine_url = "http://www.stockfishchess.org/";
+our $engine_details = undef; # For hardware.
+our $move_source = "FICS";
+our $move_source_url = "http://www.freechess.org/";
+
# Postgres configuration.
our $dbistr = "dbi:Pg:dbname=remoteglot";
our $dbiuser = undef;
my ($engine, @x) = @_;
while (scalar @x > 0) {
- if ($x[0] =~ /^(name|author)$/) {
- my $key = shift @x;
+ if ($x[0] eq 'name') {
my $value = join(' ', @x);
- $engine->{'id'}{$key} = $value;
+ $engine->{'id'}{'author'} = $value;
last;
}
my $json = {};
$json->{'position'} = $pos_calculating->to_json_hash();
- $json->{'id'} = $engine->{'id'};
+ $json->{'engine'} = $engine->{'id'};
+ if (defined($remoteglotconf::engine_url)) {
+ $json->{'engine'}{'url'} = $remoteglotconf::engine_url;
+ }
+ if (defined($remoteglotconf::engine_details)) {
+ $json->{'engine'}{'details'} = $remoteglotconf::engine_details;
+ }
+ if (defined($remoteglotconf::move_source)) {
+ $json->{'move_source'} = $remoteglotconf::move_source;
+ }
+ if (defined($remoteglotconf::move_source_url)) {
+ $json->{'move_source_url'} = $remoteglotconf::move_source_url;
+ }
$json->{'score'} = long_score($info, $pos_calculating, '');
$json->{'short_score'} = short_score($info, $pos_calculating, '');
$json->{'plot_score'} = plot_score($info, $pos_calculating, '');
+ $json->{'using_lomonosov'} = defined($remoteglotconf::tb_serial_key);
$json->{'nodes'} = $info->{'nodes'};
$json->{'nps'} = $info->{'nps'};
my $new_depth = $json->{'depth'} // 0;
my $new_nodes = $json->{'nodes'} // 0;
if (!defined($old_engine) ||
- $old_engine ne $json->{'id'}{'name'} ||
+ $old_engine ne $json->{'engine'}{'name'} ||
$new_depth > $old_depth ||
($new_depth == $old_depth && $new_nodes >= $old_nodes)) {
atomic_set_contents($filename, $encoded);
$dbh->do('DELETE FROM scores WHERE id=?', undef, $id);
$dbh->do('INSERT INTO scores (id, plot_score, short_score, engine, depth, nodes) VALUES (?,?,?,?,?,?)', undef,
$id, $json->{'plot_score'}, $json->{'short_score'},
- $json->{'id'}{'name'}, $new_depth, $new_nodes);
+ $json->{'engine'}{'name'}, $new_depth, $new_nodes);
$dbh->commit;
}
}
#linenav {
display: none;
}
+#lomonosov {
+ display: none;
+}
#games {
font-size: smaller;
</ul>
<p id="credits"><a href="http://git.sesse.net/?p=remoteglot;a=summary">remoteglot</a>
© 2007–2015 <a href="http://www.sesse.net/">Steinar H. Gunderson</a>.
- Chess analysis by <a href="http://stockfishchess.org/" id="engineid">Stockfish</a> (main analysis: 20x2.3GHz Haswell-EP,
- multi-PV search: 16x2.4GHz Haswell-EP).
- Moves provided by <a href="http://live.fide.com/sochi/">FIDE</a>.
- Hosting and multi-PV analysis hardware by <a href="http://www.samfundet.no/">Studentersamfundet i Trondhjem</a>.
+ Chess analysis by <a href="http://stockfishchess.org/" id="engineid">Stockfish</a><span id="enginedetails"></span>.
+ <span id="movesource"></span>
+ Hosting and additional analysis hardware by <a href="http://www.samfundet.no/">Studentersamfundet i Trondhjem</a>.
JavaScript chessboard powered by <a href="http://chessboardjs.com/">chessboard.js</a>
and <a href="https://github.com/jhlywa/chess.js">chess.js</a>.
Ding sound by <a href="https://www.freesound.org/people/Aiwha/sounds/196106/">Aiwha</a> (CC-BY-3.0).
- 7-man Lomonosov tablebase lookup by <a href="http://tb7.chessok.com/">ChessOK</a>.</p>
+ <span id="lomonosov">7-man Lomonosov tablebase lookup by <a href="http://tb7.chessok.com/">ChessOK</a>.</span></p>
<!-- For faster development -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
headline = 'Analysis';
}
+ // Credits, where applicable. Note that we don't want the footer to change a lot
+ // when e.g. viewing history, so if any of these changed during the game,
+ // use the current one still.
+ if (current_data['using_lomonosov']) {
+ $("#lomonosov").show();
+ } else {
+ $("#lomonosov").hide();
+ }
+
+ // Credits: The engine name/version.
+ if (current_data['engine'] && current_data['engine']['name'] !== null) {
+ $("#engineid").text(current_data['engine']['name']);
+ }
+
+ // Credits: The engine URL.
+ if (current_data['engine'] && current_data['engine']['url']) {
+ $("#engineid").attr("href", current_data['engine']['url']);
+ } else {
+ $("#engineid").removeAttr("href");
+ }
+
+ // Credits: Engine details.
+ if (current_data['engine'] && current_data['engine']['details']) {
+ $("#enginedetails").text(" (" + current_data['engine']['details'] + ")");
+ } else {
+ $("#enginedetails").text("");
+ }
+
+ // Credits: Move source, possibly with URL.
+ if (current_data['move_source'] && current_data['move_source_url']) {
+ $("#movesource").text("Moves provided by ");
+ var movesource_a = document.createElement("a");
+ movesource_a.setAttribute("href", current_data['move_source_url']);
+ var movesource_text = document.createTextNode(current_data['move_source']);
+ movesource_a.appendChild(movesource_text);
+ var movesource_period = document.createTextNode(".");
+ document.getElementById("movesource").appendChild(movesource_a);
+ document.getElementById("movesource").appendChild(movesource_period);
+ } else if (current_data['move_source']) {
+ $("#movesource").text("Moves provided by " + current_data['move_source'] + ".");
+ } else {
+ $("#movesource").text("");
+ }
+
var last_move;
if (display_data) {
// Displaying some non-current position, pick out the last move
update_clock();
- // The engine id.
- if (data['id'] && data['id']['name'] !== null) {
- $("#engineid").text(data['id']['name']);
- }
-
// The score.
if (data['score'] !== null) {
$("#score").text(data['score']);