No description
Find a file
Bhavnoor Singh Saroya 137adee58b
Some checks are pending
Test / Format (gofmt) (push) Waiting to run
Test / Lint (golangci-lint) (push) Waiting to run
Test / Test (go test) (push) Blocked by required conditions
Test / Build CLI (go install) (push) Blocked by required conditions
update readme
2025-08-18 23:39:45 -07:00
.devcontainer Bump dependencies. 2024-01-20 07:11:51 +00:00
.github Nailed it. 2023-02-20 04:47:22 +00:00
board deprecate shitty design choices 2025-08-18 23:24:53 -07:00
cli bugfix set port number 2025-08-18 23:25:19 -07:00
client DEV-1761: New rules API (#118) 2022-10-28 16:49:49 -07:00
db add db package 2025-08-18 21:29:05 -07:00
maps Gofmt. 2023-02-19 17:17:59 +00:00
test DEV 559: Refactor CLI and add customizations (#57) 2021-11-25 14:07:56 -08:00
.gitignore Bump dependencies. 2024-01-20 07:11:51 +00:00
.golangci.yaml Update go version and linting. 2023-02-19 17:12:03 +00:00
.goreleaser.yml Working goreleaser. 2020-12-10 21:08:08 -08:00
board.go DEV-1761: New rules API (#118) 2022-10-28 16:49:49 -07:00
board_test.go DEV-1761: New rules API (#118) 2022-10-28 16:49:49 -07:00
cases_test.go DEV-1761: New rules API (#118) 2022-10-28 16:49:49 -07:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT (#36) 2021-04-05 22:34:36 -07:00
constants.go new cause of death by hazard (#104) 2022-08-18 16:20:50 -07:00
constrictor.go DEV-1761: New rules API (#118) 2022-10-28 16:49:49 -07:00
constrictor_test.go Gofmt. 2023-02-19 17:17:59 +00:00
CONTRIBUTING.md Create CONTRIBUTING.md 2021-10-01 15:33:48 -07:00
Dockerfile add dockerfile for deployment 2025-08-18 23:26:09 -07:00
go.mod update go.mod and go.sum 2025-08-18 21:32:54 -07:00
go.sum update go.mod and go.sum 2025-08-18 21:32:54 -07:00
LICENSE Add standard LICENSE 2020-01-01 17:40:37 -08:00
Makefile Bump dependencies. 2024-01-20 07:11:51 +00:00
pipeline.go Gofmt. 2023-02-19 17:17:59 +00:00
pipeline_internal_test.go DEV-1761: New rules API (#118) 2022-10-28 16:49:49 -07:00
pipeline_test.go DEV-1761: New rules API (#118) 2022-10-28 16:49:49 -07:00
rand.go DEV-1313: Add additional map types (#76) 2022-06-01 11:39:31 -07:00
README.md update readme 2025-08-18 23:39:45 -07:00
royale.go Adding default values for the Royale ruleset and game map (#119) 2022-12-05 15:11:34 -08:00
royale_test.go DEV-1761: New rules API (#118) 2022-10-28 16:49:49 -07:00
ruleset.go DEV-1761: New rules API (#118) 2022-10-28 16:49:49 -07:00
ruleset_internal_test.go DEV-1761: New rules API (#118) 2022-10-28 16:49:49 -07:00
ruleset_test.go DEV-1761: New rules API (#118) 2022-10-28 16:49:49 -07:00
settings.go DEV-1761: New rules API (#118) 2022-10-28 16:49:49 -07:00
settings_test.go DEV-1761: New rules API (#118) 2022-10-28 16:49:49 -07:00
solo.go DEV-1761: New rules API (#118) 2022-10-28 16:49:49 -07:00
solo_test.go DEV-1761: New rules API (#118) 2022-10-28 16:49:49 -07:00
standard.go DEV-1761: New rules API (#118) 2022-10-28 16:49:49 -07:00
standard_test.go DEV-1761: New rules API (#118) 2022-10-28 16:49:49 -07:00
wrapped.go DEV-1761: New rules API (#118) 2022-10-28 16:49:49 -07:00
wrapped_test.go DEV-1761: New rules API (#118) 2022-10-28 16:49:49 -07:00

Custom battlesnake game engine implementation

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

play.battlesnake.com custom games are not working at the time of this commit, this custom implementation can be hosted and allows for games to be stored to a relational database, it is accompanied by a second server that can read and serve from the db, while maintaining full compatibility with the battlesnake gameboard

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.18 or higher. [Download]

go install github.com/BattlesnakeOfficial/rules/cli/battlesnake@latest

Compile from source. Also requires Go 1.18 or higher.

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

Usage

Run the hosting with ./battlesnake host

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. Local games will output different json than the official cli in an effort to improve consistency with the api.

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.

Yet the current implementation is designed around running 1 game at a time, and will require further modification for true concurrency.

Feedback

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