next abstract method

GameOrError<Game<Event>> next(
  1. E event
)

This method takes an event and returns the changed game state or an error

Errors are typically for displaying on the UI why the particular player can't make that move. So make the error as informative as possible. This method should return a copy of the state if undo functionality needs to work. (i.e. the class should be immutable), for high performance you can make the changes and just return the changed instance itself, but undo functionality won't work.

Implementation

GameOrError next(E event);