summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--maze_generator.rb3
-rw-r--r--maze_solver.rb1
-rw-r--r--tui.rb4
3 files changed, 8 insertions, 0 deletions
diff --git a/maze_generator.rb b/maze_generator.rb
index fcecd26..951e0d7 100644
--- a/maze_generator.rb
+++ b/maze_generator.rb
@@ -37,10 +37,13 @@ class MazeGenerator
TUI::Cursor.restore
puts @maze.to_s(" ")
puts
+ TUI::Screen.reset_line
puts " Stack size: #{@stack.length}"
if @stack.length < @stack_threshold
+ TUI::Screen.reset_line
puts " Current algorithm: Depth-first search"
else
+ TUI::Screen.reset_line
puts " Current algorithm: Breath-first search"
end
end
diff --git a/maze_solver.rb b/maze_solver.rb
index 90af0c1..2f75111 100644
--- a/maze_solver.rb
+++ b/maze_solver.rb
@@ -31,6 +31,7 @@ class MazeSolver
TUI::Cursor.restore
puts @maze.to_s(" ", @stack)
puts
+ TUI::Screen.reset_line
puts " Stack size: #{@stack.length}"
puts " Current algorithm: Depth-first search"
end
diff --git a/tui.rb b/tui.rb
index edc34d0..8fa0a53 100644
--- a/tui.rb
+++ b/tui.rb
@@ -9,6 +9,10 @@ module TUI
print "\e[0;0H"
end
+ def self.reset_line()
+ print "\e[2K"
+ end
+
def self.restore()
print "\e[?1049l"
end