37 lines
958 B
Markdown
37 lines
958 B
Markdown
# Publishing your agent
|
|
|
|
Once your agent behaves the way you want, you can expose it over HTTP so other clients can play against it.
|
|
|
|
You only need this if you want other programs to connect to your agent.
|
|
|
|
## Use this repository
|
|
|
|
1. Open `server.py`.
|
|
2. Replace the agent passed to `PyServer` with your own. For example:
|
|
|
|
```py
|
|
from agents.my_agent import MyAgent
|
|
|
|
player = PyServer(MyAgent())
|
|
```
|
|
|
|
3. Start the server. Run:
|
|
|
|
```sh
|
|
python server.py
|
|
```
|
|
|
|
By default, the server listens on port `5000`.
|
|
|
|
4. Open your browser and visit `http://localhost:5000/`. You should receive
|
|
a JSON document describing your agent and the games it supports.
|
|
If that works, your agent is ready to receive game requests.
|
|
|
|
## Writing your own server
|
|
|
|
The included server is the easiest way to publish a Python agent.
|
|
|
|
If you want to implement the protocol yourself
|
|
_(for example in another language)_ you can use the specification in
|
|
[the protocol specification](./spec.md).
|