* add minimal support for serving a game to the board UI
* refactor into new board package
* support reporting errors and author names to board
* support passing an alternate board URL
* avoid using IPv6 for local URL
* use rules.Point instead of a custom Point type for board package
* use zero for generic communication error code in cli
* rename createGameEvent to buildFrameEvent
* tests for conversion from boardState/snakeState to game frame
* fix for rivers and bridges snake start positions
* update max player count, add unit test
* set player count to 12 (max for smallest size)
* fix: one of the 19x19 spawn points
* randomize snake placement at start positions
* randomly choose starts in quadrants
* fix: check that start positions are valid
* modify food placement to avoid hazards
* allow initial food placement for 8 snakes on 7x7
* fix logic to be for small board
* fix inverted logic
* logic should be actually <= 4 snakes, not 7
* WIP: initial data model for new meta props
* WIP: implemented new props
* test and bug fix:
- add coverage of players and sizes
- fix unlimited map size bug
* FIX: update supported players for arcade to 6
* fix: test should be min -> max, not max->max
* Change some naming and the FixedSizes function
* update comment to reflect API changes
* improve comment clarity
* rename field for improved clarity
* change some more "map" -> "board" wording
* add helper to draw a ring of hazards
* refactor tests to not be internal tests
* add "hz_inner_wall" map
* add "hz_rings" map
* fix map registry
* fix: edge case bugs in drawRing
* remove println
* add "hz_columns"
* add "hz_rivers_bridges" map
* WIP: implementing spiral hazards map
* finish basic testing of 'hz_spiral'
* include first turn
* add "hz_hazards" map
* remove incorrect author
* add "hz_grow_box" map
* add "hz_expand_box" map
* add "hz_expand_scatter" map
* remove debug
* document the new "Range" method
* - use rules.RulesetError instead of generic error
- use a rules.Point for map rivers and bridgets map key
* use rules.RulesetError instead of errors.New
* provide more detail about boundar conditions
* fix documentation (max can be == min)
* add unit tests
* add "namcap" map
* adjust hazards and starting food positions
* add food randomly, not on top of hazards
* add exits on the top and bottom
* rename to arcade_maze
* add maps README
* test for ArcadeMazeMap
* adjustments to hazards in arcade_maze
* remove squad support and switch to using pipelines only in RulesBuilder
* remove spawn_food.standard from legacy ruleset definitions
* bugfix: Royale map generates Standard food
* add maps support to CLI
* add automated tests for all registered GameMap implementations
* update README
* reorganize code
* first draft of map generator interfaces
* add explicit random interface to board helpers
* implement standard map
* rename Generator to GameMap
* allow initializing snakes separately from placing them
* add random number generator to Settings
* updates to GameMap interface
* add helpers for creating and updating BoardState with maps
* add a new "pipeline" concept
- added new Pipeline type which is a series of stages
- added a global registry to facilitate plugin architecture
- 100% test coverage
* Refactor rulesets to provide and use Pipeline
* fix copypasta comments
* fix lint for unused method
* include game over stages in ruleset pipelines
* clean up unused private standard methods
* remove unused private methods in squad ruleset
* remove unused private methods in royale ruleset
* refactor: pipeline clone + return next board state
* YAGNI: remove unused Append
* refactor: improve stage names
* add no-op behavior to stages for initial state
* refactor: no-op decision within stage functions
* remove misleading comment that isn't true
* dont bother checking for init in gameover stages
* remove redundant test
* refactor: provide a combined ruleset/pipeline type
* fix: movement no-op for GameOver check
IsGameOver needs to run pipeline, move snakes needs to no-op for that
* add test coverage
* refactor: improve stage names and use constants
* add Error method
Support error checking before calling Execute()
* update naming to be American style
* panic when overwriting stages in global registry
* rename "Error" method and improve docs
* use testify lib for panic assertion
* remove redundant food stage
* use ruleset-specific logic for game over checks
* re-work Pipeline errors
* rework errors again
* add defensive check for zero length snake
* use old logic which checks current state, not next
* add warning about how PipelineRuleset checks for game over
- Update usage section in the README with the latest flags.
- Update default sample output (BoardState fields have changed,
OutOfBounds has been removed).
- Add section describing options for getting JSON output with the
`--output` and `--debug-requests` flag.
Refactor rulesets into smaller composable operations
In order to mix up the functionality from different rulesets like Solo, Royale, etc. the code in these classes needs to be broken up into small functions that can be composed in a pipeline to make a custom game mode.
* New flag -c to use colors in the cli board view
* Error handeling
* Fix formatting
* Extracted ANSI escape codes into a different file
* Fixed formatting
* 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
* move snake API structs into a new client package
* add customizations to snake objects
* refactor and add support for passing snake customizations in games
* fix sending of new params
* add royale and squad settings to requests
* add --debug-requests option
* update test for request body and add helper
Co-authored-by: Penelope Phippen <penelope@hey.com>
* extract board generation out of rules.Ruleset
* update comment and remove redundant interface check
* clone boardState in constrictor to respect the ModifyBoardState interface
* move hazard damage into StandardRuleset
* OutOfBounds -> Hazards
* remove "out of bounds" in comment
* add cases for eating food to hazard damage test