No description
Find a file
Len Payne 6c1e0d9547
Command Line Interface to Run Games Locally (#25)
* Initial Attempts at Cobra Command
* Update to the README
* Fixes for Linter

Thanks @LenPayne for all your hard work getting this started!
2020-12-10 14:35:52 -08:00
.github Update main.yml 2020-07-29 10:49:50 -07:00
cli Command Line Interface to Run Games Locally (#25) 2020-12-10 14:35:52 -08:00
.gitignore Command Line Interface to Run Games Locally (#25) 2020-12-10 14:35:52 -08:00
go.mod Command Line Interface to Run Games Locally (#25) 2020-12-10 14:35:52 -08:00
go.sum Command Line Interface to Run Games Locally (#25) 2020-12-10 14:35:52 -08:00
LICENSE Add standard LICENSE 2020-01-01 17:40:37 -08:00
maze.go "Feast" -> "Maze". Fix backfill bug. (#26) 2020-12-08 13:20:13 -08:00
maze_test.go "Feast" -> "Maze". Fix backfill bug. (#26) 2020-12-08 13:20:13 -08:00
README.md Command Line Interface to Run Games Locally (#25) 2020-12-10 14:35:52 -08:00
royale.go Rename "EliminatedByStarvation" > "EliminatedByOutOfHealth" 2020-09-10 12:00:56 -07:00
royale_test.go Rename "EliminatedByStarvation" > "EliminatedByOutOfHealth" 2020-09-10 12:00:56 -07:00
ruleset.go Fix function name and interface tests. 2020-05-17 14:38:39 -07:00
solo.go Add solo gameplay ruleset. 2020-05-17 14:29:30 -07:00
solo_test.go Fix function name and interface tests. 2020-05-17 14:38:39 -07:00
squad.go Rename TeamRuleset -> SquadRuleset 2020-07-21 14:58:56 -07:00
squad_test.go Rename "EliminatedByStarvation" > "EliminatedByOutOfHealth" 2020-09-10 12:00:56 -07:00
standard.go "Feast" -> "Maze". Fix backfill bug. (#26) 2020-12-08 13:20:13 -08:00
standard_test.go Add parameters for food spawn chance and min food. 2020-11-20 12:00:58 -08:00

BattlesnakeOfficial/rules

codecov

Battlesnake rules and game logic, implemented as a Go module. Issues and contributions welcome!

FAQ

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 a result, the majority of engine code was concerned with scalable game execution and not the actual game rules. As part of that refactor we moved the game logic implementation 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).

Can I run games locally?

This was functionality that an older version of the game logic provided, including a release binary. We'd like to recreate that behaviour and include it in this repo, but for now it doesn't exist. See Issue #20 for more info.

The Y-Axis appears to be implemented incorrectly?

This is because the game rules implement an inverted Y-Axis. Older versions of the Battlesnake API operated this way, and several highly competitive Battlesnakes still rely on this behaviour and we'd still like to upport them. The current game engine accounts for this by translating the Y-Axis (or not) based on which version of the API each Battlesnake implements. More info here and here.

In the future we might switch this to make the rules easier to develop? But until we drop support for the older API version it doesn't make sense to make that change.

CLI Build Instructions

From the root folder of the project, run:

go build -o battlesnake cli/main.go

This will create the battlesnake command, that you can use. It currently has one verb: play.

Use the CLI to configure and play a game of Battlesnake against 
multiple snakes, with multiple rulesets.

Usage:
  battlesnake play [flags]

Flags:
  -g, --gametype string     Type of Game Rules (default "standard")
  -H, --height int32        Height of Board (default 11)
  -h, --help                help for play
  -n, --name stringArray    Name of Snake
  -s, --sequential          Use Sequential Processing
  -S, --squad stringArray   Squad of Snake
  -t, --timeout int32       Request Timeout (default 500)
  -u, --url stringArray     URL of Snake
  -v, --viewmap             View the Map Each Turn
  -W, --width int32         Width of Board (default 11)

Global Flags:
      --config string   config file (default is $HOME/.battlesnake.yaml)

For more details, see the CLI-Specific README