Sha256: 12c254d61d0c3d267fe19ff7f132eefcb722923d59193949f87c1f0064350d68
Contents?: true
Size: 751 Bytes
Versions: 1
Compression:
Stored size: 751 Bytes
Contents
#!/usr/bin/env ruby lib_path = File.expand_path('../../lib', __FILE__) $:.unshift(lib_path) require 'calc24' require 'calc24/version' begin raise Calc24::VERSION if ['--version', '-v'].include? ARGV[0] # validate user input digits = ARGV.to_i raise "need 4 digits, such as: 5 9 5 9" unless digits.size == 4 t0 = Time.now player = Calc24::TwentyFourGamePlayer.new(digits) if player.solutions.empty? puts "no solutions" else puts "found #{player.solutions.size} solutions:" #STDIN.gets puts player.solutions.values.join("\n").to_p puts "#{Time.now - t0}s" end rescue Exception => e print "#{e.class}: " unless e.class == RuntimeError puts "#{e.message}" exit 1 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
24games-0.2.2 | bin/24games |