scalata.infrastructure.view.terminal.Shared
Terminal-view helper utilities shared.
Responsibilities
• Wire a map GameControllerState ⇒ Controller[F] so that the GameEngine
can route the state machine to the correct controller. • Provide a generic run loop that repeatedly asks the user for input until the supplied parse function succeeds.
• Offer small helper parsers (e.g. booleanParse) used by several interactive screens.
Attributes
Graph
Reset zoom Hide graph Show graph
Supertypes
class Object
trait Matchable
class Any
Self type
Members list
Parse a yes/no question.
Accepts only a single-letter y or n (case-insensitive), trimmed of surrounding white-space.
Value parameters
raw
user-supplied string
Attributes
Returns
Some(true) if "y" Some(false) if "n" None otherwise
Build the state → controller lookup table for the terminal UI.
Build the state → controller lookup table for the terminal UI.
Type parameters
F
effect type (e.g. IO) in which controllers operate
Value parameters
view
shared GameView used by all controllers for rendering and input
Attributes
Returns
a partial function: given the current scalata.domain.util.GameControllerState , return the corresponding controller instance
Generic input loop that keeps asking the player until parse returns Some.
Generic input loop that keeps asking the player until parse returns Some.
Value parameters
gameView
view through which we display prompts / errors and read input
parse
function that tries to convert raw input I to domain value O
Attributes
Returns
the successfully parsed value wrapped in the effect F