Sha256: dbf8a58e88762db1b4956cfd381cdc0007502e8f4a9ca773b3324e0a1ec2cf41
Contents?: true
Size: 875 Bytes
Versions: 1
Compression:
Stored size: 875 Bytes
Contents
#!/usr/bin/env ruby lib_path = File.expand_path('../../lib', __FILE__) $:.unshift(lib_path) require 'calc24' require 'calc24/version' begin numbers = [] raise Calc24::VERSION if ['--version', '-v'].include? ARGV[0] if ARGV.count == 1 and ARGV[0].size == 4 ARGV[0].each_char do |c| numbers << c.to_i end elsif ARGV.count == 4 numbers = ARGV.to_i else raise " inputs 4 numbers such as: 5959 or 5 9 5 9" end t0 = Time.now player = Calc24::TwentyFourGamePlayer.new(numbers) if player.solutions.empty? puts "no solutions" else puts "found #{player.solutions.size} solutions:\n\n" puts player.solutions.values.join("\n").to_p puts "\n#{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.4 | bin/24games |