Sha256: 2442f247ebb97060f89c4b0badfc845ef3e0250a49eb69e167ad6aec734f4cdb
Contents?: true
Size: 920 Bytes
Versions: 1
Compression:
Stored size: 920 Bytes
Contents
#!/usr/bin/env ruby require './lib/rmaze.rb' require 'optparse' options = { :width => 10, :height => 10, :algorithm => :backtrace } OptionParser.new do |opts| opts.banner = "Usage: rmaze [options]" opts.separator "" opts.separator "Basic options:" opts.on("-w", "--width width", "Specify the maze width (default: #{options[:width]})") do |width| options[:width] = width end opts.on("-h", "--height height", "Specify the maze height (default: #{options[:height]})") do |height| options[:height] = height end opts.separator "" opts.separator "Algorithms:" opts.on("-b", "--backtrace", "Choose backtrace algorithm (default)") do |bt| options[:algorithm] = bt ? :backtrace : nil end end.parse! maze = nil case options[:algorithm] when :backtrace maze = MazeBTrace.new(options[:width], options[:height]) else $stderr.puts "Error: the algorithm must be set." exit(-1) end maze.generate maze.print
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rmaze-1.5.0 | bin/rmaze |