Method: Maze#play

Defined in:
lib/vg_tools.rb

#play {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Maze)

    the object that the method was called on



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/vg_tools.rb', line 74

def play
  # reset_screen; 
  start_time = Time.now.to_f
  yield(self)
  end_time = Time.now.to_f
  time_difference = (end_time - start_time).round(3)
  # minutes = time_difference / 60
  # seconds = time_difference % 60
  # total_time = ""
  # total_time += "#{minutes} Minute" if minutes > 0
  # total_time += "s" if minutes > 1
  # total_time += ", " if minutes > 0 && seconds > 0
  # total_time += "#{seconds} Second" if seconds > 0
  # total_time += "s" if seconds > 1
  puts "Total Time: #{time_difference}"
end