GameEngine

scalata.infrastructure.controller.GameEngine
class GameEngine[F[_]]

Orchestrates high-level state transitions of the game.

  • Picks the controller that matches the current GameControllerState.
  • Delegates one step to that controller.
  • Reads the returned GameResult and, if successful, recurses with the next phase and updated GameBuilder.
  • Ends with ExitCode.Success when any controller returns an error (e.g. player quit).

Type parameters

F

effect type (usually IO)

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

final def gameLoop(gamePhaseService: GamePhaseService, gameBuilder: GameBuilder, controllers: GameControllerState => Controller[F]): F[ExitCode]

Runs the main finite-state machine loop.

Runs the main finite-state machine loop.

Value parameters

controllers

lookup: state → concrete controller

gameBuilder

current builder carrying player and difficulty

gamePhaseService

holder of the current phase; mutated via transitionTo

Attributes