No description
Find a file
Simon Agius Muscat 142a5a6ecf
Add export to file (#58)
* Initial addition of a game exporter

* Fix snake state bug, remove test logs, fix final output line being empty

* Ignore test JSONL file

* Added explanation for design decision on the you key in SnakeResponse

* Adjust gitignore to be more generic

* Retain consistency in usage of pointer

* Re-word explanation to refer to requests instead of responses

* Remove unnecessary nil check

* Check error returned by WriteString

* Change file permissions for output file

* Initialise gameexporter regardless of whether output is requested

* Print error and exit if export to file fails

* Added another comment explaining reasoning around export checks

* Fixed broken test due to changed return type
2021-12-02 09:59:20 -08:00
.github Update CODEOWNERS 2021-09-07 09:46:35 -07:00
cli Add export to file (#58) 2021-12-02 09:59:20 -08:00
client DEV 559: Refactor CLI and add customizations (#57) 2021-11-25 14:07:56 -08:00
test DEV 559: Refactor CLI and add customizations (#57) 2021-11-25 14:07:56 -08:00
.gitignore Add export to file (#58) 2021-12-02 09:59:20 -08:00
.goreleaser.yml Working goreleaser. 2020-12-10 21:08:08 -08:00
board.go add turn to BoardState and remove it from RoyaleRuleset (#52) 2021-08-27 13:28:12 -07:00
board_test.go DEV-280: Extract board generation out of rules.Ruleset (#51) 2021-08-23 17:13:58 -07:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT (#36) 2021-04-05 22:34:36 -07:00
constrictor.go DEV-280: Extract board generation out of rules.Ruleset (#51) 2021-08-23 17:13:58 -07:00
constrictor_test.go DEV-280: Extract board generation out of rules.Ruleset (#51) 2021-08-23 17:13:58 -07:00
CONTRIBUTING.md Create CONTRIBUTING.md 2021-10-01 15:33:48 -07:00
go.mod Bump to Go 1.15 2021-01-19 14:42:36 -08:00
go.sum go mod tidy 2021-01-19 14:55:07 -08:00
LICENSE Add standard LICENSE 2020-01-01 17:40:37 -08:00
README.md Update README.md 2021-05-18 09:07:03 -07:00
royale.go add turn to BoardState and remove it from RoyaleRuleset (#52) 2021-08-27 13:28:12 -07:00
royale_test.go add turn to BoardState and remove it from RoyaleRuleset (#52) 2021-08-27 13:28:12 -07:00
ruleset.go Add missing ruleset params to request body and --debug-requests option (#55) 2021-09-07 14:58:10 -07:00
ruleset_test.go DEV 559: Refactor CLI and add customizations (#57) 2021-11-25 14:07:56 -08:00
solo.go Remove ruleset versions for GitHub release version (future). 2021-07-02 20:09:55 -07:00
solo_test.go add ruleset data to the calls made by the cli (name and version) (#32) 2021-07-02 20:00:19 -07:00
squad.go Remove ruleset versions for GitHub release version (future). 2021-07-02 20:09:55 -07:00
squad_test.go add ruleset data to the calls made by the cli (name and version) (#32) 2021-07-02 20:00:19 -07:00
standard.go DEV-280: Extract board generation out of rules.Ruleset (#51) 2021-08-23 17:13:58 -07:00
standard_test.go DEV-280: Extract board generation out of rules.Ruleset (#51) 2021-08-23 17:13:58 -07:00
wrapped.go wrapped ruleset (#30) 2021-08-24 12:11:36 -07:00
wrapped_test.go wrapped ruleset (#30) 2021-08-24 12:11:36 -07:00

BattlesnakeOfficial/rules

codecov

Battlesnake rules and game logic, implemented as a Go module. This code is used in production at play.battlesnake.com. Issues and contributions welcome!

CLI for Running Battlesnake Games Locally

This repo provides a simple CLI tool to run games locally against your dev environment.

Installation

Download precompiled binaries here:
https://github.com/BattlesnakeOfficial/rules/releases

Install as a Go package. Requires Go 1.15 or higher. [Download]

go get github.com/BattlesnakeOfficial/rules/cli/battlesnake

Compile from source. Also requires Go 1.15 or higher.

git clone git@github.com:BattlesnakeOfficial/rules.git
cd rules
go build -o battlesnake ./cli/battlesnake/main.go

Usage

Example command to run a game locally:

battlesnake play -W 11 -H 11 --name <SNAKE_NAME> --url <SNAKE_URL> -g solo -v

For more details, see the CLI README.

FAQ

Can I run games locally?

Yes! See the included CLI.

How is this different from the old Battlesnake engine?

The old game engine was re-written in early 2020 to handle a higher volume of concurrent games. As part of that rebuild we moved the game logic into a separate Go module that gets compiled into the production engine.

This provides two benefits: it makes it much simpler/easier to build new game modes, and it allows the community to get more involved in game development (without the maintenance overhead of the entire game engine).

Feedback

  • Do you have an issue or suggestions for this repository? Head over to our Feedback Repository today and let us know!