Using the gist that was posted to the Code Club gitter room as a guide here is a basic implementation in place for the REPL. It works as follows:
Each Game has an associated GameRunner class, this manages all the commands available to the player at 'play time' (so we can add things like hints, help etc.)
The REPL then takes an instance of one of these runners and handles setting up the interactive shell and passes the user input to the GameRunner which then handles the parsing of commands and calling functions from the game etc.
This is not perfect as there are a number of things still needed to be done such as:
Closing/Restarting the game once the player has won
Using the gist that was posted to the Code Club gitter room as a guide here is a basic implementation in place for the REPL. It works as follows:
Game
has an associatedGameRunner
class, this manages all the commands available to the player at 'play time' (so we can add things like hints, help etc.)REPL
then takes an instance of one of these runners and handles setting up the interactive shell and passes the user input to theGameRunner
which then handles the parsing of commands and calling functions from the game etc.This is not perfect as there are a number of things still needed to be done such as: