Commit graph

14 commits

Author SHA1 Message Date
Rob O'Dwyer
82e1999126
DEV-1761: New rules API (#118)
* DEV-1761: Clean up Ruleset interface (#115)

* remove legacy ruleset types and simplify ruleset interface

* remove unnecessary settings argument from Ruleset interface

* decouple rules.Settings from client API and store settings as strings

* DEV 1761: Add new BoardState and Point fields (#117)

* add Point.TTL, Point.Value, GameState and PointState to BoardState

* allow maps to access BoardState.GameState,PointState

* add PreUpdateBoard and refactor snail_mode with it

* fix bug where an extra turn was printed to the console

* fix formatting

* fix lint errors

Co-authored-by: JonathanArns <jonathan.arns@googlemail.com>
2022-10-28 16:49:49 -07:00
Rob O'Dwyer
639362ef46
DEV 1916: Fix output issues in CLI (#114)
* adding testing of output file and write line for /end

* fix regression in latency rounding for board
2022-10-20 13:16:52 -07:00
Rob O'Dwyer
5f60ccbba8
DEV 1793: Track latency, status codes, and errors from CLI games (#113)
* track latency and status code from CLI games

* actually track errors from snake responses
2022-10-04 15:53:29 -07:00
Rob O'Dwyer
09aea9c49d
DEV 1666: Fix /end requests and clean up logging (#109)
* ensure /end request is always called, and refactor win/draw logic

* clean up logging and error handling during initialization

* automatically generate friendly snake names

* title-case snake names

* print out list of alive snake names instead of count

* log snake names, IDs, and URLs at startup

* print out state for turn zero
2022-09-02 14:35:55 -07:00
Rob O'Dwyer
a451cda9c4
DEV 1404: Support streaming CLI games to the browser board (#88)
* 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
2022-06-28 16:17:44 -07:00
Rob O'Dwyer
1adbc79168
DEV 953: Add basic maps support to CLI (#74)
* 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
2022-05-25 11:24:27 -07:00
Rob O'Dwyer
447cbba8c0 add tests for convertRulesSnakes 2022-03-22 12:00:45 -07:00
Torben
397d925110
DEV-765 pipeline refactor (#64)
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.
2022-03-16 16:58:05 -07:00
Simon Agius Muscat
142a5a6ecf
Add export to file (#58)
* 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
2021-12-02 09:59:20 -08:00
Rob O'Dwyer
4a9dbbcaef
DEV 559: Refactor CLI and add customizations (#57)
* move snake API structs into a new client package

* add customizations to snake objects

* refactor and add support for passing snake customizations in games
2021-11-25 14:07:56 -08:00
Rob O'Dwyer
31faba642c
Add missing ruleset params to request body and --debug-requests option (#55)
* 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>
2021-09-07 14:58:10 -07:00
Rob O'Dwyer
e416384007
Refactor RoyaleRuleset and move hazard damage into StandardRuleset (#50)
* move hazard damage into StandardRuleset

* OutOfBounds -> Hazards

* remove "out of bounds" in comment

* add cases for eating food to hazard damage test
2021-08-17 16:47:06 -07:00
bvanvugt
9dba91619a Fix latency string in unit test. 2021-07-02 20:08:58 -07:00
John Oram
f31bdff4b8
add ruleset data to the calls made by the cli (name and version) (#32)
* add ruleset data to the cli (name and version)
* remove double ruleset tracking with royale mode
2021-07-02 20:00:19 -07:00