From c43839f4713828de4820ca82d2a99b0eb5f7651f Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Sat, 23 Apr 2022 12:09:25 +0200 Subject: more elaborate game rules --- web/pw-server/src/lib/components/RulesView.svelte | 99 ++++++++++++++++------- 1 file changed, 72 insertions(+), 27 deletions(-) (limited to 'web/pw-server') diff --git a/web/pw-server/src/lib/components/RulesView.svelte b/web/pw-server/src/lib/components/RulesView.svelte index 58e6bf2..177b5b1 100644 --- a/web/pw-server/src/lib/components/RulesView.svelte +++ b/web/pw-server/src/lib/components/RulesView.svelte @@ -1,27 +1,41 @@ -
-

- Every turn, your bot will receive a json-encoded line on stdin, representing the current game - state. -

+
+
+

Welcome to planetwars!

- Example game state: -
{`
+    

+ Planetwars is a game of galactic conquest for busy people. Your goal is to program a bot that + will conquer the galaxy for you, while you take care of more important stuff. +

+

+ In every game turn, your bot will receive a json-encoded line on stdin, describing the current + state of the game. Each state will hold a set of planets, and a set of spaceship fleets + traveling between the planets (expeditions). +

+

Example game state:

+
{`
   {
     "planets": [
       {
-          "ship_count": 2,
-          "x": -2.0,
-          "y": 0.0,
-          "owner": 1,
-          "name": "your planet"
+        "ship_count": 2,
+        "x": -2.0,
+        "y": 0.0,
+        "owner": 1,
+        "name": "your planet"
       },
       {
-          "ship_count": 4,
-          "x": 2.0,
-          "y": 0.0,
-          "owner": 2,
-          "name": "enemy planet"
+        "ship_count": 4,
+        "x": 2.0,
+        "y": 0.0,
+        "owner": 2,
+        "name": "enemy planet"
       },
+      {
+        "ship_count": 2,
+        "x": 0.0,
+        "y": 2.0,
+        "owner": null,
+        "name": "neutral planet"
+      }
     ],
     "expeditions": [
       {
@@ -36,13 +50,20 @@
   }
   `}
-

- Every turn, you may send out expeditions to conquer other planets. You can do this by writing a - json-encoded line to stdout: -

+

+ The owner field holds a player number when the planet is held by a player, and is + null otherwise. Your bot is always referred to as player 1.
+ Each turn, every player-owned planet will gain one additional ship.
+ Planets will never move during the game. +

- Example command: -
{`
+    

+ Every turn, you may send out expeditions to conquer other planets. You can do this by writing + a json-encoded line to stdout: +

+ +

Example command:

+
{`
   {
     "moves": [
       {
@@ -54,16 +75,40 @@
   }
   `}
   
+

+ All players send out their commands simultaneously, so there is no turn order. You may send as + many commands as you please. +

+ +

+ The amount of turns an expedition will travel is equal to the ceiled euclidean distance + between its origin and target planet. +

+ +

+ Ships will only battle on planets. Combat resolution is simple: every ship destroys one enemy + ship, last man standing gets to keep the planet. +

- The amount of turns an expedition will travel is equal to the ceiled euclidean distance between - its origin and target planet. +

+ Head over to the editor view to get started - a working example is provided.
+ Feel free to just hit the play button to see how it works! +

+
-- cgit v1.2.3