From 14bd2d5e24a8b9e8a40cb54fd0a0bcfbc9435df6 Mon Sep 17 00:00:00 2001 From: ajuvercr Date: Tue, 7 Apr 2020 11:31:28 +0200 Subject: [PATCH] add all the help --- backend/src/info.rs | 2 +- backend/static/style/help.css | 64 ++++++++++++++++++++++++- backend/templates/help/help_1.html.tera | 50 ++++++++----------- backend/templates/help/help_2.html.tera | 16 ++++++- backend/templates/help/help_3.html.tera | 39 +++++++++++++-- backend/templates/help/help_4.html.tera | 42 ++++++++++++++++ backend/templates/help/help_5.html.tera | 30 ++++++++++++ backend/templates/help/help_6.html.tera | 28 +++++++++++ backend/templates/index.html.tera | 2 +- 9 files changed, 233 insertions(+), 40 deletions(-) create mode 100644 backend/templates/help/help_4.html.tera create mode 100644 backend/templates/help/help_5.html.tera create mode 100644 backend/templates/help/help_6.html.tera diff --git a/backend/src/info.rs b/backend/src/info.rs index 688b987..c09536a 100644 --- a/backend/src/info.rs +++ b/backend/src/info.rs @@ -5,7 +5,7 @@ use rocket_contrib::templates::Template; use crate::util::*; -const MAX: usize = 3; +const MAX: usize = 6; #[get("/info")] fn help_base() -> Redirect { diff --git a/backend/static/style/help.css b/backend/static/style/help.css index 044ae89..0811fe0 100644 --- a/backend/static/style/help.css +++ b/backend/static/style/help.css @@ -1,5 +1,6 @@ .content { justify-content: center; + max-height: 100%; } .pointer { @@ -16,14 +17,14 @@ height: 70%; width: 100%; clip-path: polygon(100% 0%, 50% 48%, 100% 100%, 50% 100%, 0% 50%, 50% 0); - background-color: #ff7f00; + background-color: #A35200; } .p_right { margin: 5px; height: 70%; width: 100%; - background-color: #ff7f00; + background-color: #A35200; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0% 100%, 50% 50%, 0% 0%); } @@ -70,6 +71,11 @@ margin: auto; } +.help_content { + overflow: auto; + height: 100%; +} + .boxed { border: 3px #A35200 solid; border-radius: 50px; @@ -109,6 +115,28 @@ margin: 10px; } +.help_content_2 { + display: flex; + flex-direction: column; + width: 80%; + justify-content: space-evenly; + margin: 0 auto; +} + +.help_content_2 h2 { + margin: 2px 0; + margin-top: 20px; +} + +.help_content_2 em { + color: #A35200; +} + +.help_content_2 h3 { + margin: 5px; + color: #bbb; +} + .arrow { width: 20%; background-color: #A35200; @@ -119,4 +147,36 @@ .arrow>div { text-align: center; +} + +ul { + margin: 10px inherit; + color: #eee; + font-size: 1.5em; +} + +li { + margin: 10px 10px; +} + +.help_content_1 h2 { + color: #bbb; + margin-top: 2em; + font-size: 1.7; +} + +pre { + padding: 0; + margin-bottom: -20px; +} + +pre code { + background-color: #333; + border: 1px solid #eee; + display: block; + padding: 20px; +} + +.commands { + font-size: 1.3em; } \ No newline at end of file diff --git a/backend/templates/help/help_1.html.tera b/backend/templates/help/help_1.html.tera index 9301a7b..79dd979 100644 --- a/backend/templates/help/help_1.html.tera +++ b/backend/templates/help/help_1.html.tera @@ -2,41 +2,29 @@ {% block header %} -How does it work? +Information {% endblock %} {% block help %} -
-
-
- Game State -
-
-
-
- stdin -
-
-
-
- Bot (you!) -
-
-
-
- stdout -
-
-
-
- Actions -
-
-
-
-
Turn
-
+
+

Rules

+ +

Turn Order

+ +
+ {% endblock %} diff --git a/backend/templates/help/help_2.html.tera b/backend/templates/help/help_2.html.tera index a8faba1..b8729bb 100644 --- a/backend/templates/help/help_2.html.tera +++ b/backend/templates/help/help_2.html.tera @@ -2,13 +2,25 @@ {% block header %} - +Information {% endblock %} {% block help %} - +
+

Combat resolution

+ +

How to win

+ +
{% endblock %} diff --git a/backend/templates/help/help_3.html.tera b/backend/templates/help/help_3.html.tera index a8faba1..4077981 100644 --- a/backend/templates/help/help_3.html.tera +++ b/backend/templates/help/help_3.html.tera @@ -2,13 +2,46 @@ {% block header %} - +Interaction with the game {% endblock %} {% block help %} - - +
+
+
+ Game State +
+
+
+
+ stdin +
+
+
+
+ Bot (you!) +
+
+
+
+ stdout +
+
+
+
+ Actions +
+
+
+
+
Turn
+
+
+

+ Format: line-separated JSON (one line for each turn) +

+
{% endblock %} diff --git a/backend/templates/help/help_4.html.tera b/backend/templates/help/help_4.html.tera new file mode 100644 index 0000000..1a42297 --- /dev/null +++ b/backend/templates/help/help_4.html.tera @@ -0,0 +1,42 @@ +{% extends "help/base" %} + +{% block header %} + +Format: Game state + +{% endblock %} + + +{% block help %} + +
+
+        {
+    "planets": [
+        {
+            “name”: “my cool planet”,
+            “x”: 42,
+            “y”: 42,
+            “owner”: 1,
+            “ship_count”: 23
+        }
+    ],
+    "expeditions": [
+        {
+            “id”: 1000,
+            “origin”: “my boring planet”,
+            “destination”: “my cool planet”,
+            “turns_remaining”: 3,
+            “owner”: 2,
+            “ship_count”: 18
+        }
+    ]
+}
+    
+ +

Player numbers are rotated so that you are always player 1.

+

Note that player numbers are 1-based.

+

Neutral planets exist, they don’t have an owner (not in JSON, null, …)

+
+ +{% endblock %} diff --git a/backend/templates/help/help_5.html.tera b/backend/templates/help/help_5.html.tera new file mode 100644 index 0000000..3dcd496 --- /dev/null +++ b/backend/templates/help/help_5.html.tera @@ -0,0 +1,30 @@ +{% extends "help/base" %} + +{% block header %} + +Format: Player turn (actions) + +{% endblock %} + + +{% block help %} + +
+
+        {
+    “moves”: [
+        {
+            “origin”: “my boring planet”,
+            “destination”: “my cool planet”,
+            “ship_count”: 23
+        }
+    ]
+}
+    
+ +

Invalid commands are ignored by the game implementation.

+

If your bot crashes, you can reconnect but chances of winning are slim.

+

Your bot is allowed one second to compute its turn.

+
+ +{% endblock %} diff --git a/backend/templates/help/help_6.html.tera b/backend/templates/help/help_6.html.tera new file mode 100644 index 0000000..f7040c2 --- /dev/null +++ b/backend/templates/help/help_6.html.tera @@ -0,0 +1,28 @@ +{% extends "help/base" %} + +{% block header %} + +How to connect + +{% endblock %} + + +{% block help %} + +
+ +

You run your bot at your own pc and connect over tcp.

+

Follow these commands to connect using simple.py.

+ +
+        
+$ wget mozaic.zeus.gent/bot/runner.py
+$ wget mozaic.zeus.gent/bot/simple.py
+$ python runner.py -p 9142 --host mozaic.zeus.gent \
+    -n <Your name> -i <Id from the lobby> \
+    python simple.py
+        
+    
+
+ +{% endblock %} diff --git a/backend/templates/index.html.tera b/backend/templates/index.html.tera index ca6eaec..236581b 100644 --- a/backend/templates/index.html.tera +++ b/backend/templates/index.html.tera @@ -28,7 +28,7 @@

Create a game

- +

Step 3:

Play!