So much better now

This commit is contained in:
2019-03-28 16:16:51 +01:00
parent bf925cfb88
commit eb364a0ce6
11 changed files with 58 additions and 21 deletions
+38
View File
@@ -0,0 +1,38 @@
doctype html
html(lang='en')
head
meta(charset='utf-8')
meta(name='viewport', content='width=device-width, initial-scale=1, shrink-to-fit=no')
link(rel='stylesheet', href='/static/main.css')
block extracss
body.layout-documentation.page-components
title Pytron
nav.navbar.is-link(role='navigation', aria-label='main navigation')
.container
.navbar-brand
a.navbar-item.is-size-4(href='/')
strong Pytron
a.navbar-burger.burger(role='button', aria-label='menu', aria-expanded='false', data-target='navbarBasicExample')
span(aria-hidden='true')
span(aria-hidden='true')
span(aria-hidden='true')
#navbarBasicExample.navbar-menu
.navbar-end
a.navbar-item.is-size-6(href='/upload')
strong Upload your AI
block content
script.
document.addEventListener('DOMContentLoaded', () => {
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
if ($navbarBurgers.length > 0) {
$navbarBurgers.forEach( el => {
el.addEventListener('click', () => {
const target = el.dataset.target;
const $target = document.getElementById(target);
el.classList.toggle('is-active');
$target.classList.toggle('is-active');
});
});
}
});
block extrajs
+22
View File
@@ -0,0 +1,22 @@
table.table.is-bordered.is-striped.is-narrow.is-hoverable
tr
th
for ai in data.ais
th.has-text-centered= ai.name
for ai1 in data.ais
tr
th.has-text-centered= ai1.name
for ai2 in data.ais
if ai1.name == ai2.name
td
else if data.battles[ai1.name + "/" + ai2.name] > data.battles[ai2.name + "/" + ai1.name]
td.has-text-centered.has-text-success= data.battles[ai1.name + "/" + ai2.name]
else if data.battles[ai1.name + "/" + ai2.name] < data.battles[ai2.name + "/" + ai1.name]
td.has-text-centered.has-text-danger= data.battles[ai1.name + "/" + ai2.name]
else
td.has-text-centered= data.battles[ai1.name + "/" + ai2.name]
.columns.is-centered
.column.is-narrow
caption
strong All battles
+8
View File
@@ -0,0 +1,8 @@
extends base_html
block content
section.section
.container
.message.is-danger
.message-header An error occured
.message-body= message
+33
View File
@@ -0,0 +1,33 @@
extends base_html
block extracss
link(rel="stylesheet", href="https://use.fontawesome.com/releases/v5.8.1/css/all.css", integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf", crossorigin="anonymous")
block content
section.section
.container
if running
#running
.columns.is-centered
.column.is-3.is-desktop
h5.title.is-5 Some battles are running
span#dots ...
else
#running(style="display:none")
.columns.is-centered
.column.is-3.is-desktop
h5.title.is-5 Some battles are running
span#dots ...
.columns.is-centered
.column.is-narrow.is-desktop
#leaderboard
include leaderboard
.columns.is-centered
.column.is-narrow.is-desktop
#battles
include battles
block extrajs
script(src="static/main.js")
+30
View File
@@ -0,0 +1,30 @@
table.table.is-bordered.is-striped.is-hoverable
tr
th.has-text-centered AI
th.has-text-centered Victories
th.has-text-centered Nulls
th.has-text-centered Defeats
th.has-text-centered Score
for ai in data.sortedAis
tr
td.has-text-centered
if ai.rank === 1
span.icon
i.fas.fa-trophy(style="color:#FFD700")
else if ai.rank === 2
span.icon
i.fas.fa-trophy(style="color:#C0C0C0")
else if ai.rank === 3
span.icon
i.fas.fa-trophy(style="color:#CD7F32")
strong= ai.name
td.has-text-centered= ai.victories
td.has-text-centered= ai.nulls
td.has-text-centered= ai.defeats
td.has-text-centered
strong= ai.score
.columns.is-centered
.column.is-narrow
caption
strong Leaderboard
+62
View File
@@ -0,0 +1,62 @@
extends base_html
block content
section.section
.container
.columns.is-centered
.column.is-6.is-desktop
form(action="upload-target", method="POST", encType="multipart/form-data")
.field
label.label Name
p.content.has-text-justified
| This name will be the name you will see on
| the leaderboard. It also corresponds to the
| name of the module your AI will be on the
| server.
p.content.has-text-justified
| You can use an already existing name to
| replace it with a new version of your AI.
input.input(type="text", name="name", placeholder="Name of your AI")
.fielg
label.label Password
p.content.has-text-justified
| This password will allow you to update your
| AI. If the name you specify is not used,
| this password can be anything you want. If
| the name you specify already exists, you need
| to enter the password you entered when you
| uploaded the AI the first time.
input.input(type="password", name="password", placeholder="Password")
.field
label.label Archive
p.content.has-text-justified
| The archive to upload needs to contain a file
| named <code>ai.py</code> which must contain a
| class named <code>Ai</code> which must contain
| a constructor that takes no arguments (other
| than self or optional arguments).
p.content.has-text-justified
| It may also contain more files, such as
| binary files with neural network weights, or
| such as other python modules.
p.content.has-text-justified
| Please, use as few modules as possible. The
| server won't have pygame or matplotlib, so
| importing those kind of modules in your AI
| will crash the script.
p.content.has-text-justified
| Please note that this archive must not
| contain a directory, it must only contain the
| files.
.file.has-name
label.file-label
input.file-input(type="file", name="archive")
span.file-cta
span.file-icon
i.fas.fa-upload
span.file-label Choose a file…
span.file-name
.field
input.button.is-link(type="submit", value="Submit")