aboutsummaryrefslogtreecommitdiff
path: root/web/pw-server/src/lib/components/RulesView.svelte
blob: c3cf125eb4d2ef60d16f681fc5838258a42250b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<div class="game-rules">
  <p>
    Every turn, your bot will receive a json-encoded line on stdin, representing the current game
    state.
  </p>

  Example game state:
  <pre>{`
  {
    "planets": [
      {
          "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"
      },
    ],
    "expeditions": [
      {
        "id": 169,
        "ship_count": 8,
        "origin": "your planet",
        "destination": "enemy planet",
        "owner": 1,
        "turns_remaining": 2
      }
    ]
  }
  `}</pre>

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

  Example command:
  <pre>{`
  {
    "moves": [
      {
        "origin": "your planet",
        "target": "enemy planet",
        "ship_count": 2
      }
    ]
  }
  `}
  </pre>

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

<style lang="scss">
  .game-rules {
    padding: 15px;
    overflow-y: scroll;
    height: 100%;
    margin-bottom: 200px;
    box-sizing: border-box;
  }
</style>