Commit graph

12 commits

Author SHA1 Message Date
Torben
61aeee31d6
allow placement of up to 16 snakes on xlarge board (#90) 2022-06-29 14:26:18 -07:00
Torben
9d6b1147cd
fix for rivers and bridges snake start positions (#85)
* 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
2022-06-28 14:41:01 -07:00
Torben
f58df66e69
allow initial food placement for 8 snakes on 7x7 board (#87)
* 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
2022-06-22 16:14:15 -07:00
Torben
3bd1e47bb4
change all "int32" types to "int" (#75) 2022-05-25 11:17:41 -07:00
Rob O'Dwyer
e94d758a9b
DEV 1303: Add empty and royale maps and update game map interface (#72)
* move random generator into Settings

* add empty and royale maps

* place snakes on either cardinal or corner positions first
2022-05-17 15:45:56 -07:00
Rob O'Dwyer
dab9178a55
DEV 1247: Add a new map generator interface (#71)
* 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
2022-05-11 08:26:28 -07:00
Torben
d378759d58
DEV-1096 - add a new "pipeline" concept (#67)
* 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
2022-04-19 15:52:57 -07:00
Brad Van Vugt
573a93fa30
Stop spawning food in corners in competitive play. (#68) 2022-04-07 07:59:21 -07:00
bvanvugt
6e01793750 Remove equidistant food spawns that are closer to center. 2022-01-18 20:51:01 +00:00
bvanvugt
4df2c65432 Restrict fixed food spawns to only locations further from center. 2022-01-18 20:21:21 +00:00
Rob O'Dwyer
e9f408cdbb
add turn to BoardState and remove it from RoyaleRuleset (#52) 2021-08-27 13:28:12 -07:00
Rob O'Dwyer
015b681f14
DEV-280: Extract board generation out of rules.Ruleset (#51)
* extract board generation out of rules.Ruleset

* update comment and remove redundant interface check

* clone boardState in constrictor to respect the ModifyBoardState interface
2021-08-23 17:13:58 -07:00