257 lines
9.5 KiB
HTML
257 lines
9.5 KiB
HTML
{% extends "OpenBench/base.html" %}
|
|
|
|
{% block scripts %}
|
|
|
|
var Configurations = {
|
|
{% for name, data in config.engines.items %}
|
|
'{{name}}' : {
|
|
'base' : "{{data.base}}",
|
|
'book' : "{{data.book}}",
|
|
'bounds' : "{{data.bounds}}",
|
|
},
|
|
{% endfor %}
|
|
};
|
|
|
|
var TestModes = {
|
|
{% for name, data in config.engines.items %}
|
|
'{{name}}' : [
|
|
{% for mode in data.testmodes %}
|
|
{
|
|
{% for key, value in mode.items %}
|
|
'{{key}}' : '{{value}}',
|
|
{% endfor %}
|
|
},
|
|
{% endfor %}
|
|
],
|
|
{% endfor %}
|
|
};
|
|
|
|
var Networks = [
|
|
{% for network in networks %}
|
|
{
|
|
"name" : "{{network.name}}",
|
|
"sha256" : "{{network.sha256}}",
|
|
"engine" : "{{network.engine}}",
|
|
"default" : "{{network.default}}",
|
|
},
|
|
{% endfor %}
|
|
];
|
|
|
|
|
|
function set_test_type(type) {
|
|
|
|
//// When the test mode is set or changed, run this.
|
|
//// Sets the bounds, confidence intervals, and max games fields.
|
|
|
|
var selectA = document.getElementById("test_mode");
|
|
var mode = selectA.options[selectA.selectedIndex].value;
|
|
|
|
var selectB = document.getElementById("enginename");
|
|
var engine = selectB.options[selectB.selectedIndex].value;
|
|
|
|
if (mode == "SPRT") {
|
|
document.getElementById("test_bounds").value = Configurations[engine]["bounds"]
|
|
document.getElementById("test_confidence").value = "{{config.tests.confidence}}";
|
|
document.getElementById("test_max_games").value = "N/A";
|
|
}
|
|
|
|
if (mode == "GAMES") {
|
|
document.getElementById("test_bounds").value = "N/A";
|
|
document.getElementById("test_confidence").value = "N/A";
|
|
document.getElementById("test_max_games").value = "{{config.tests.max_games}}";
|
|
}
|
|
}
|
|
|
|
function set_test_mode(mode_idx) {
|
|
|
|
//// Sets any of the possible following options:
|
|
//// Threads, Hash, Book, time Control, Test Mode, Bounds, Games
|
|
|
|
var selection = document.getElementById("enginename");
|
|
var engine = selection.options[selection.selectedIndex].value;
|
|
var mode = TestModes[engine][mode_idx];
|
|
|
|
if (mode["th"] != null && mode["hash"] != null) {
|
|
var threads = mode["th"]; var hash = mode["hash"];
|
|
document.getElementById("devoptions").value = "Threads=" + threads + " Hash=" + hash;
|
|
document.getElementById("baseoptions").value = "Threads=" + threads + " Hash=" + hash;
|
|
}
|
|
|
|
if (mode["book"] != null) {
|
|
document.getElementById("bookname").value = mode["book"]
|
|
}
|
|
|
|
if (mode["tc"] != null) {
|
|
document.getElementById("timecontrol").value = mode["tc"];;
|
|
}
|
|
|
|
if (mode["bounds"] != null) {
|
|
document.getElementById("test_mode").value = "SPRT"; set_test_type();
|
|
document.getElementById("test_bounds").value = mode["bounds"];
|
|
}
|
|
|
|
if (mode["games"] != null) {
|
|
document.getElementById("test_mode").value = "GAMES"; set_test_type();
|
|
document.getElementById("test_max_games").value = mode["games"];
|
|
}
|
|
|
|
// Default back when not specified
|
|
|
|
if (mode["bounds"] == null && mode["games"] == null) {
|
|
document.getElementById("test_mode").value = "SPRT"; set_test_type();
|
|
}
|
|
|
|
if (mode["book"] == null) {
|
|
document.getElementById("bookname").value = Configurations[engine]["book"];
|
|
}
|
|
}
|
|
|
|
function set_engine(engine) {
|
|
|
|
//// Creates a button to setup test modes, as specififed in the Engine's
|
|
//// entry in config.py. Also sets the opening book, and default base branch
|
|
//// based on the same config entry. Finally, creates a list of all uploaded
|
|
//// Network files that can be selected. The default Network is set as such,
|
|
//// if it exists. In all cases, a blank Network is included in the options.
|
|
|
|
document.getElementById("enginename").value = engine;
|
|
|
|
var button_div = document.getElementById("test-mode-buttons");
|
|
while (button_div.hasChildNodes()) button_div.removeChild(button_div.lastChild);
|
|
|
|
for (let i in TestModes[engine]) {
|
|
const btn = document.createElement('button')
|
|
btn.innerHTML = TestModes[engine][i]["id"];
|
|
btn.onclick = function() { set_test_mode(i); };
|
|
btn.class = (i % 2) ? "left-floated" : "right-floated";
|
|
button_div.append(btn);
|
|
}
|
|
|
|
var devnet = document.getElementById("devnetwork");
|
|
var basenet = document.getElementById("basenetwork");
|
|
var hasdefault = false;
|
|
|
|
while (devnet.length) devnet.remove(0);
|
|
while (basenet.length) basenet.remove(0);
|
|
|
|
for (const network of Networks) {
|
|
|
|
if (network.engine !== engine) continue;
|
|
|
|
var devopt = document.createElement("option");
|
|
var baseopt = document.createElement("option");
|
|
|
|
devopt.text = baseopt.text = network.name;
|
|
devopt.value = baseopt.value = network.sha256;
|
|
|
|
devopt.selected = network.default == "True";
|
|
baseopt.selected = network.default == "True";
|
|
devnet.add(devopt); basenet.add(baseopt);
|
|
|
|
hasdefault = (hasdefault || (network.default == "True"));
|
|
}
|
|
|
|
{
|
|
var devopt = document.createElement("option");
|
|
var baseopt = document.createElement("option");
|
|
|
|
devopt.text = baseopt.text = "None";
|
|
devopt.value = baseopt.value = "";
|
|
|
|
devopt.selected = (hasdefault == false); devnet.add(devopt);
|
|
baseopt.selected = (hasdefault == false); basenet.add(baseopt);
|
|
}
|
|
|
|
var base_branch = document.getElementById("basebranch");
|
|
base_branch.value = Configurations[engine]["base"];
|
|
|
|
var book_selection = document.getElementById("bookname");
|
|
book_selection.value = Configurations[engine]["book"];
|
|
}
|
|
|
|
|
|
document.addEventListener(
|
|
'DOMContentLoaded', function () {
|
|
set_test_type();
|
|
set_engine("{{profile.engine}}");
|
|
set_test_mode(0);
|
|
}, false
|
|
);
|
|
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
|
|
<form method="POST" action="/newTest/">
|
|
{% csrf_token %}
|
|
<div class="settings-column">
|
|
|
|
<h3> Engine </h3>
|
|
<label> Engine </label> <select id="enginename" name="enginename">
|
|
{% for engine in config.engines %}
|
|
<option onClick="set_engine('{{engine}}')" value="{{engine}}">{{engine}}</option>
|
|
{% endfor %}
|
|
</select><br>
|
|
<label> Source </label> <input value="{{profile.repo}}" name="source"><br>
|
|
|
|
<h3> Dev Settings </h3>
|
|
<label> Dev Bench </label> <input name="devbench"><br>
|
|
<label> Dev Branch </label> <input name="devbranch" autofocus><br>
|
|
<label> Dev Options </label> <input id="devoptions" name="devoptions"><br>
|
|
<label> Dev Network </label> <select id="devnetwork" name="devnetwork"></select><br>
|
|
|
|
<h3> Base Settings </h3>
|
|
<label> Base Bench </label> <input name="basebench"><br>
|
|
<label> Base Branch </label> <input id="basebranch" name="basebranch"><br>
|
|
<label> Base Options </label> <input id="baseoptions" name="baseoptions"><br>
|
|
<label> Base Network </label> <select id="basenetwork" name="basenetwork"></select><br>
|
|
|
|
</div>
|
|
|
|
<div class="settings-column">
|
|
|
|
<h3> Game Settings </h3>
|
|
<label> Book </label> <select id="bookname" name="bookname">
|
|
{% for name, data in config.books.items %}
|
|
<option value="{{name}}">{{name}}</option>
|
|
{% endfor %}
|
|
</select><br>
|
|
<label> Time </label> <input id="timecontrol" name="timecontrol"><br>
|
|
|
|
<h3> Test Settings </h3>
|
|
<label> Test Mode </label> <select onchange='set_test_type()' id="test_mode" name="test_mode">
|
|
<option selected value="SPRT"> SPRT </option>
|
|
<option value="GAMES"> Fixed Games </option>
|
|
</select><br>
|
|
<label> Bounds </label> <input id="test_bounds" name="bounds"><br>
|
|
<label> Confidence </label> <input id="test_confidence" name="confidence"><br>
|
|
<label> Max Games </label> <input id="test_max_games" name="max_games"><br>
|
|
|
|
<h3> General Settings </h3>
|
|
<label> Priority </label> <input value="0" name="priority"><br>
|
|
<label> Throughput </label> <input value="1000" id="throughput", name="throughput"><br>
|
|
|
|
<label> Syzygy ADJ </label> <select name="syzygy_adj">
|
|
<option selected value="OPTIONAL"> Optional </option>
|
|
<option value="REQUIRED"> Required </option>
|
|
<option value="DISABLED"> Disabled </option>
|
|
</select><br>
|
|
|
|
<label> Syzygy WDL </label> <select name="syzygy_wdl">
|
|
<option value="OPTIONAL"> Optional </option>
|
|
<option value="REQUIRED"> Required </option>
|
|
<option selected value="DISABLED"> Disabled </option>
|
|
</select><br>
|
|
|
|
</div>
|
|
|
|
<br><input type="submit" name="submit" value="Create Engine Test">
|
|
|
|
</form>
|
|
|
|
<div id="test-mode-buttons">
|
|
<!-- Generated based on the selected Engine -->
|
|
</div>
|
|
|
|
{% endblock %}
|