CLI

class CLI(val commands: Array<CommandImpl<Game>>, val debug: Boolean = false, debugCommands: Array<CommandImpl<Game>> = arrayOf())

Simple command-line interface coordinator.

Holds the set of available CommandImpl<Game> objects, manages an optional debug mode and runs the interactive read-eval-print loop that dispatches commands to the parser.

Constructors

Link copied to clipboard
constructor(commands: Array<CommandImpl<Game>>, debug: Boolean = false, debugCommands: Array<CommandImpl<Game>> = arrayOf())

Properties

Link copied to clipboard
val commands: Array<CommandImpl<Game>>

Array of command implementations available in the CLI.

Link copied to clipboard

Whether debug mode is enabled.

Link copied to clipboard
val finalCommands: Array<CommandImpl<Game>>
Link copied to clipboard
val parser: CommandParser<Game>
Link copied to clipboard
val parserConfig: ParserConfig<Game>

Functions

Link copied to clipboard
private fun log(message: String)
Link copied to clipboard
fun parseInput(input: String, context: Game? = null): Game?

Parses user input and executes the corresponding command.

Link copied to clipboard
fun startLoop()

Entry point for the CLI version of the Reversi game. Initializes the board and command parser, and handles user input in an interactive loop.