Class: ChessEngine::CLI
- Inherits:
-
Object
- Object
- ChessEngine::CLI
- Includes:
- Input
- Defined in:
- lib/chess_engine/cli.rb
Instance Method Summary collapse
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
Methods included from Input
Constructor Details
#initialize ⇒ CLI
Returns a new instance of CLI.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/chess_engine/cli.rb', line 12 def initialize begin mode = get_input("\nChoose the game mode:\n1. New game\n2. Continue\nEnter your choice (1 or 2): ", /^[12]$/) @game = mode == "1" ? Game.new : choose_game rescue NoGamesError => e puts "#{e.}. Try again" retry end play save if save? end |