* Commit from Stream We got the maze working decently well! Started off with exploring the repo a bit and getting used to the Map stuff The Maze is working pretty well except the mazes that are generated aren't actually complete-able yet. They end up creating spaces that are blocked off from the rest of the map The maze generation algo is based off 'Recursive division method' mostly following this Wiki This looked to always create a 'valid' maze, while mine doesn't so need to figure out what my bug is, cause I'm pretty sure there is one! * I think we got maze generation working! Did a lot, should have commited more lol Got map generation working where I can see it go frame by frame, and think we squashed the last few bugs with wall generation and hole cutting Now need it to actually make a new maze when you finish this first one * We can run on a bigger board now, and we place the food randomly on the board after you grab it the first time * Make sure my health is always 100 so don't have to worry about that lol * Fix placing of food on maze to NOT be on an existing hazard and after 3 foods make a new maze * Maze generation works better now and a bit of cleanup * Committing old code * Got state saving as Hazards Bits Working well, I think whats up next is making the map grow each level * Draw maze in the center of the board, the maze grows as you complete levels until it fills the entire board * Ran go fmt * Remove my little debugging script that I added * Revert changes I made initially to the map interface * Move my copy-pasted printMap function to my map specifically * Go fmt * Write some doc comments and fix some weird code artifacts * A few more comments and one last go fmt * Cut less holes, this makes the maze more exciting * Add version to Metadata and go fmt again * Can collapse this down * Random food spawns are more fun for sure * add minimal support for serving a game to the board UI * We did 3 main things here: - Fixed the bug where hazards were getting multi-stacked - Fixed the bug where the food could spawn on top of the snake head - Fixed the lint errors * Games aren't infinite now, they end by not spawning a food when you have reached a certain number of turns at the max board size * Extract some functions to make deciding when the game is over easier * Get evil mode implemented to force the game to end * Fix small bugs about where we spawned the food in evil mode * Have the snake keep growing by adding tail segments to match the current level. We start at two length because 1 lenth snakes look weird on the board since they don't have a neck to orient themselves. Here we also fix a bug where evil mode was trying to place food off the map * Run go fmt * Add the missing meta-data pieces * Support a smaller board without the change of infinite loops and change the name of the maze * Rename the actual struct and fix the tests to not make extra snakes when the map doesn't support it * Revert "add minimal support for serving a game to the board UI" This reverts commit 0ac3592c7669ab1bccd7bd3322adffbef5e911ce. * add minimal support for serving a game to the board UI * Cleanup and extract and function to place food so we don't have basically the same body twice. This also will prevent the initial food spawn from being right next to the snake * Revert "add minimal support for serving a game to the board UI" This reverts commit c1a3b134213dabf44df56e3ca1e6d30ff8aaa516. * Fix lint * 2 length snakes are silly, so lets start with 3 each time * We start out with 3 length snakes, and a fixed set of map sizes Co-authored-by: Rob O'Dwyer <odwyerrob@gmail.com> |
||
|---|---|---|
| .github | ||
| board | ||
| cli | ||
| client | ||
| maps | ||
| test | ||
| .gitignore | ||
| .goreleaser.yml | ||
| board.go | ||
| board_test.go | ||
| cases_test.go | ||
| CODE_OF_CONDUCT.md | ||
| constants.go | ||
| constrictor.go | ||
| constrictor_test.go | ||
| CONTRIBUTING.md | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| pipeline.go | ||
| pipeline_internal_test.go | ||
| pipeline_test.go | ||
| rand.go | ||
| README.md | ||
| royale.go | ||
| royale_test.go | ||
| ruleset.go | ||
| ruleset_internal_test.go | ||
| ruleset_test.go | ||
| solo.go | ||
| solo_test.go | ||
| standard.go | ||
| standard_test.go | ||
| wrapped.go | ||
| wrapped_test.go | ||
BattlesnakeOfficial/rules
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.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
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!