diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..60c2515 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +SHELL := /bin/bash +SERVER_PORT := 50051 +BOT_PORT := 3001 +BOT_NAME := go-bot1 + +runbotgo: + go run ./src/bot.go -bn=$(BOT_NAME) -la=:$(BOT_PORT) -gs=:$(SERVER_PORT) + +.PHONY: runbotgo diff --git a/README.md b/README.md index b4c2eb7..eeee848 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,32 @@ This is a Go bot that can be used to play the game of Lighthouses on the CodeConz platform. ## Interaction flow with the Game Engine + ![Interaction Flow](./docs/interaction_flow.png) The bot interacts with the game engine in three steps: -1. **Join Game**: The bot sends a join request to the game engine to join the game. The game engine responds with the Bot ID. -2. **Get Initial State**: The game engine sends get the initial state of the game to the bots. + +1. **Join Game**: The bot sends a join request to the game engine to join the +game. The game engine responds with the Bot ID. +2. **Get Initial State**: The game engine sends get the initial state of the + game to the bots. 3. **Turn request**: The game engine requests the bot to make an action on each turn, and sends the current state to the bot. The bot responds with the action. -For more in depth information on the game, please refer to the [Game Engine documentation](https://github.com/intelygenz/codeconz-lighthouses-engine/blob/master/README.md). \ No newline at end of file +For more in depth information on the game, please refer to the [Game Engine documentation](https://github.com/intelygenz/codeconz-lighthouses-engine/blob/master/README.md). + +## Run locally + +To run the bot locally, you need to have Go installed on your machine. You can +download Go from [here](https://golang.org/dl/). + +To run the bot, you can use the following command: + +```bash +make runbotgo +``` + +## Notes + +- You can start implementing your bot in the `src/bot.go` file. +- Do not change anything in the Dockerfile, .github/workflows or protobuf files. +- The bot will not be able to connect to the game engine if it is not running.