Class: MyOwnMaze

Inherits:
Object
  • Object
show all
Defined in:
lib/my_own_maze.rb

Instance Method Summary collapse

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

#runObject



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