Class: MyOwnMaze
- Inherits:
-
Object
- Object
- MyOwnMaze
- Defined in:
- lib/my_own_maze.rb
Instance Method Summary collapse
-
#initialize(type) ⇒ MyOwnMaze
constructor
A new instance of MyOwnMaze.
- #run ⇒ Object
Constructor Details
#initialize(type) ⇒ MyOwnMaze
Returns a new instance of MyOwnMaze.
7 8 9 10 11 |
# File 'lib/my_own_maze.rb', line 7 def initialize(type) @level = 1 @type = type init_game end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/my_own_maze.rb', line 13 def run clear_screen @game.start loop do input = STDIN.getch exit if input == 'e' @game.do(input) if input != nil && input != '' success if @game.success? end # rescue StandardError # exit ensure print "\x1b[?25h" # show cursor end |