Sha256: ea6aafe9ba9acf4d58447ed94b717239abe40bcd10613232350182cc9b9c3f03
Contents?: true
Size: 582 Bytes
Versions: 1
Compression:
Stored size: 582 Bytes
Contents
#!/usr/bin/env ruby require 'calc24' begin # 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.1 | bin/24games |