GameSession

scalata.domain.world.GameSession
See theGameSession companion object
final case class GameSession(world: World, gameState: GameState, history: NonEmptyList[(World, GameState)])

Immutable wrapper that couples a World with its GameState and keeps an undo history.

==== Fields ====

  • world current game world (rooms, player, difficulty).

  • gameState progress on the current run.

  • history non-empty list of previous snapshots, newest first, used for the undo feature.

All “update” methods return a new GameSession; nothing is mutated in place.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

Push current snapshot onto the history stack.

Push current snapshot onto the history stack.

Attributes

Undo the last stored snapshot; if none left, add an UndoError note and keep the current state.

Undo the last stored snapshot; if none left, add an UndoError note and keep the current state.

Attributes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product