update docs
- divide rules doc in sections - clarify turn order - document logging to stderr - bump turn limit to 500
This commit is contained in:
parent
6887c8ee0e
commit
9e05a9bdd5
2 changed files with 40 additions and 11 deletions
|
@ -72,9 +72,11 @@ CMD python simplebot.py
|
||||||
Refer to https://docs.docker.com for guides on how to write your own dockerfile.
|
Refer to https://docs.docker.com for guides on how to write your own dockerfile.
|
||||||
|
|
||||||
In the directory that contains your `Dockerfile`, run the following command:
|
In the directory that contains your `Dockerfile`, run the following command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker build -t my-bot-name .
|
docker build -t my-bot-name .
|
||||||
```
|
```
|
||||||
|
|
||||||
If all went well, your docker daemon now holds a container tagged as `my-bot-name`.
|
If all went well, your docker daemon now holds a container tagged as `my-bot-name`.
|
||||||
|
|
||||||
### Publishing the bot
|
### Publishing the bot
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
## How to play
|
# How to play
|
||||||
|
|
||||||
|
## Protocol
|
||||||
|
|
||||||
In every game turn, your bot will receive a json-encoded line on stdin, describing the current
|
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
|
state of the game. Each state will hold a set of planets, and a set of spaceship fleets
|
||||||
|
@ -46,7 +48,6 @@ Example game state:
|
||||||
|
|
||||||
The `owner` field holds a player number when the planet is held by a player, and is
|
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.
|
`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.
|
Planets will never move during the game.
|
||||||
|
|
||||||
Every turn, you may send out expeditions to conquer other planets. You can do this by writing
|
Every turn, you may send out expeditions to conquer other planets. You can do this by writing
|
||||||
|
@ -64,24 +65,50 @@ Example command:
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
You can dispatch as many expeditions as you like.
|
||||||
```
|
```
|
||||||
|
|
||||||
All players send out their commands simultaneously, so there is no turn order. You may send as
|
## Rules
|
||||||
many commands as you please.
|
|
||||||
|
All players send out their commands simultaneously, so there is no player order.
|
||||||
|
|
||||||
The amount of turns an expedition will travel is equal to the ceiled euclidean distance
|
The amount of turns an expedition will travel is equal to the ceiled euclidean distance
|
||||||
between its origin and destination planet.
|
between its origin and destination planet.
|
||||||
|
|
||||||
|
Each turn, one additional ship will be constructed on each player-owned planet.
|
||||||
|
Neutral planets do not construct ships.
|
||||||
|
|
||||||
Ships will only battle on planets. Combat resolution is simple: every ship destroys one enemy
|
Ships will only battle on planets. Combat resolution is simple: every ship destroys one enemy
|
||||||
ship, last man standing gets to keep the planet.
|
ship, last man standing gets to keep the planet. When no player has ships remaining, the planet will turn neutral.
|
||||||
|
|
||||||
|
A turn progresses as follows:
|
||||||
|
|
||||||
|
1. Construct ships
|
||||||
|
2. Dispatch expeditions
|
||||||
|
3. Arrivals & combat resolution
|
||||||
|
|
||||||
|
It is not allowed for players to abandon a planet - at least one ship should remain at all times.
|
||||||
|
Note that you are still allowed to dispatch the full ship count you observe in the game state,
|
||||||
|
as an additional ship will be constructed before the ships depart.
|
||||||
|
|
||||||
The game will end when no enemy player ships remain (neutral ships may survive), or when the
|
The game will end when no enemy player ships remain (neutral ships may survive), or when the
|
||||||
turn limit is reached. The default limit is 100 turns.
|
turn limit is reached. When the turn limit is hit, the game will end it a tie.
|
||||||
|
Currently, the limit is set at 500 turns.
|
||||||
|
|
||||||
You can code your bot in python 3.10. You have the entire stdlib at your disposal.
|
## Writing your bot
|
||||||
If you'd like additional libraries or a different programming language, feel free to nag the administrator.
|
|
||||||
|
|
||||||
### TL;DR
|
You can code a bot in python 3.10 using the [web editor](/editor). A working example bot is provided.
|
||||||
|
If you'd like to use a different programming language, or prefer coding on your own editor,
|
||||||
|
you can try [local development](/docs/local-development).
|
||||||
|
|
||||||
Head over to the editor view to get started - a working example is provided.
|
As logging to stdout will be interpreted as commands by the game server, we suggest you log to stderr.
|
||||||
Feel free to just hit the play button to see how it works!
|
In python, you can do this using
|
||||||
|
|
||||||
|
```python
|
||||||
|
print("hello world", file=sys.stderr)
|
||||||
|
```
|
||||||
|
|
||||||
|
Output written to stderr will be displayed alongside the match replay.
|
||||||
|
|
||||||
|
Feel free to launch some test matches to get the hang of it!
|
||||||
|
|
Loading…
Reference in a new issue