Skip to content

Commit edb9af1

Browse files
authored
Merge pull request #88 from AI-Tournaments/Sync-arena
Sync arena
2 parents bb3e8cb + e41a38e commit edb9af1

6 files changed

Lines changed: 19 additions & 18 deletions

File tree

Arena

Submodule Arena updated from 8924eba to 75a920f

Dev/index.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
<script async src="https://www.googletagmanager.com/gtag/js?id=G-TJFMG29186"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-TJFMG29186');</script>
77
<meta content="width=device-width, initial-scale=1.0" name="viewport">
88
<meta content="yes" name="mobile-web-app-capable">
9-
<script src="https://cdn.jsdelivr.net/npm/jsoneditor@9.7.0/dist/jsoneditor.min.js"></script>
10-
<script src="https://cdn.jsdelivr.net/npm/jsoneditor@9.7.0/dist/jsoneditor.min.js"></script>
9+
<script src="https://cdn.jsdelivr.net/npm/jsoneditor@9.10.2/dist/jsoneditor.min.js"></script>
10+
<link href="https://cdn.jsdelivr.net/npm/jsoneditor@9.10.2/dist/jsoneditor.min.css" rel="stylesheet">
1111
<script src="../GitHubApi.js"></script>
12-
<link href="https://cdn.jsdelivr.net/npm/jsoneditor@9.7.0/dist/jsoneditor.min.css" rel="stylesheet">
1312
<link rel="stylesheet" href="../defaults.css">
1413
<style>
1514
html, body, #editor {

Dev/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function a(){
66
if(GitHubApi.getSessionStorage().acceptedDev){
77
acceptedDev = true;
88
}
9-
let defaultSetup = {
9+
const defaultSetup = {
1010
active: false,
1111
comment: '',
1212
autoStart: false,
@@ -21,7 +21,7 @@ function a(){
2121
};
2222
_editor = new JSONEditor(document.getElementById('editor'), {
2323
'modes': ['tree', 'code'],
24-
'name': 'Setups',
24+
'name': 'Test setups',
2525
'onChange': ()=>{
2626
_editor.validate().then(errors => {
2727
if(!errors.length){
@@ -92,7 +92,7 @@ function a(){
9292
if(url && (url[0] === '?' || url[0] === '!')){
9393
if(acceptedDev === undefined){
9494
let session = GitHubApi.getSessionStorage();
95-
acceptedDev = 'i accept unsandboxed sources' === (prompt('By having exclamation (!) and question (?) marks first in the URL you side steps all security features and you do so at your own risk. Only do this to URLs for code that you trust.\n\nWrite "I accept unsandboxed sources" to allow unsandboxed sources.')??'').toLowerCase();
95+
acceptedDev = 'I accept unsandboxed sources' === (prompt('By having exclamation (!) and question (?) marks first in the URL you side steps all security features and you do so at your own risk. Only do this to URLs for code that you trust.\n\nWrite "I accept unsandboxed sources" to allow unsandboxed sources.')??'').toLowerCase();
9696
session.acceptedDev = acceptedDev;
9797
GitHubApi.setSessionStorage(session);
9898
}
@@ -159,7 +159,7 @@ function a(){
159159
}
160160
}, schemaDefs);
161161
});
162-
let mode = localStorage.getItem('LocalDevelopment.Mode');
162+
const mode = localStorage.getItem('LocalDevelopment.Mode');
163163
if(mode){
164164
_editor.setMode(mode);
165165
}

Replay/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<script async src="https://www.googletagmanager.com/gtag/js?id=G-TJFMG29186"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-TJFMG29186');</script>
77
<meta content="width=device-width, initial-scale=1.0" name="viewport">
88
<meta content="yes" name="mobile-web-app-capable">
9-
<script src="https://cdn.jsdelivr.net/npm/jsoneditor@9.7.0/dist/jsoneditor.min.js"></script>
10-
<link href="https://cdn.jsdelivr.net/npm/jsoneditor@9.7.0/dist/jsoneditor.min.css" rel="stylesheet">
9+
<script src="https://cdn.jsdelivr.net/npm/jsoneditor@9.10.2/dist/jsoneditor.js"></script>
10+
<link href="https://cdn.jsdelivr.net/npm/jsoneditor@9.10.2/dist/jsoneditor.min.css" rel="stylesheet">
1111
<link rel="stylesheet" href="../defaults.css">
1212
<style>
1313
html {

Replay/index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function a(){
2020
let _replayData;
2121
let _previousOption;
2222
let _autoStart = false;
23-
fetch('/schemaDefs.json').then(response => response.json()).then(schemaDefs => {
23+
const schemaDefsPromise = fetch('/schemaDefs.json').then(response => response.json()).then(schemaDefs => {
2424
_editor.setSchema({
2525
type: 'object',
2626
required: ['header', 'body'],
@@ -62,15 +62,15 @@ function a(){
6262
type: 'object',
6363
required: ['score', 'members', 'team'],
6464
properties: {
65-
score: {type: 'number'},
65+
score: {type: ['number', 'null']},
6666
members: {
6767
type: 'array',
6868
items: {
6969
type: 'object',
7070
required: ['name', 'bonus'],
7171
properties: {
7272
name: {type: 'string'},
73-
bonus: {type: 'number'}
73+
bonus: {type: ['number', 'null']}
7474
}
7575
}
7676
},
@@ -213,7 +213,7 @@ function a(){
213213
return errors;
214214
}
215215
function onChange(){
216-
_editor.validate().then(errors => {
216+
schemaDefsPromise.then(()=>_editor.validate().then(errors => {
217217
let containsError = 0 < errors.length;
218218
_element_btnLock.disabled = containsError;
219219
document.getElementById('invalid-input').classList[containsError ? 'remove' : 'add']('hidden');
@@ -224,11 +224,13 @@ function a(){
224224
}
225225
if(_autoStart){
226226
_autoStart = false;
227-
if(!containsError){
227+
if(containsError){
228+
console.error('Replay error', errors);
229+
}else{
228230
_element_btnLock.onclick();
229231
}
230232
}
231-
});
233+
}));
232234
}
233235
function refreshStoredReplays(){
234236
while(0 < _element_previousReplayOptions.childElementCount){

schemaDefs.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"type": "object",
1313
"required": ["score", "bonusPoints"],
1414
"properties": {
15-
"score": {"type": "number"},
15+
"score": {"type": ["number", "null"]},
1616
"bonusPoints": {
1717
"type": "array",
1818
"items": {
@@ -21,7 +21,7 @@
2121
"properties": {
2222
"participant": {"type": "string"},
2323
"team": {"type": "number"},
24-
"bonus": {"type": "number"}
24+
"bonus": {"type": ["number", "null"]}
2525
}
2626
}
2727
}

0 commit comments

Comments
 (0)