24games 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -1,8 +1,5 @@
1
1
  *.gem
2
- *.sw?
3
- .DS_Store
4
- coverage
5
- doc
6
- pkg
7
- Gemfile*
8
2
  .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ *.komodoproject
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in nim.gemspec
4
+ gemspec
@@ -6,7 +6,7 @@
6
6
 
7
7
  gem install 24games
8
8
 
9
- 24games 5 9 5 9
9
+ 24games 5959 #or 5 9 5 9
10
10
 
11
11
  you get it:
12
12
 
@@ -6,12 +6,19 @@ require 'calc24'
6
6
  require 'calc24/version'
7
7
 
8
8
  begin
9
- raise Calc24::VERSION if ['--version', '-v'].include? ARGV[0]
9
+ digits = []
10
10
 
11
- # validate user input
12
- digits = ARGV.to_i
11
+ raise Calc24::VERSION if ['--version', '-v'].include? ARGV[0]
13
12
 
14
- raise "need 4 digits, such as: 5 9 5 9" unless digits.size == 4
13
+ if ARGV.count == 1 and ARGV[0].size == 4
14
+ ARGV[0].each_char do |c|
15
+ digits << c
16
+ end
17
+ elsif ARGV.count == 4
18
+ digits = ARGV.to_i
19
+ else
20
+ raise " inputs 4 numbers such as: 5959 or 5 9 5 9"
21
+ end
15
22
 
16
23
  t0 = Time.now
17
24
  player = Calc24::TwentyFourGamePlayer.new(digits)
@@ -19,10 +26,9 @@ begin
19
26
  if player.solutions.empty?
20
27
  puts "no solutions"
21
28
  else
22
- puts "found #{player.solutions.size} solutions:"
23
- #STDIN.gets
29
+ puts "found #{player.solutions.size} solutions:\n\n"
24
30
  puts player.solutions.values.join("\n").to_p
25
- puts "#{Time.now - t0}s"
31
+ puts "\n#{Time.now - t0}s"
26
32
  end
27
33
  rescue Exception => e
28
34
  print "#{e.class}: " unless e.class == RuntimeError
@@ -1,25 +1,21 @@
1
1
  # -*- encoding: utf-8 -*-
2
-
3
- $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
2
+ $:.push File.expand_path("../lib", __FILE__)
4
3
  require 'calc24/version'
5
4
 
6
5
  Gem::Specification.new do |s|
7
- s.name = %q{24games}
6
+ s.name = "24games"
8
7
  s.version = Calc24::VERSION
9
8
  s.platform = Gem::Platform::RUBY
10
9
  s.authors = ["takafan"]
11
- s.email = %q{takafan@hululuu.com}
12
- s.homepage = %q{http://github.com/takafan/24games"}
10
+ s.email = ["takafan@163.com"]
11
+ s.homepage = "http://github.com/takafan/24games"
13
12
  s.summary = %q{24 game/Solve}
14
- s.description = %q{
15
- computes an expression to solve the 24 game if possible.
16
- }
13
+ s.description = %q{computes an expression to solve the 24 game if possible.}
17
14
 
18
- s.required_rubygems_version = %q{>= 1.3.6}
19
- s.rubyforge_project = %q{24games}
15
+ s.rubyforge_project = "24games"
20
16
 
21
- s.files = `git ls-files`.split("\n")
22
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
23
- s.rdoc_options = ["--charset=UTF-8"]
24
- s.require_path = %q{lib}
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
25
21
  end
@@ -10,7 +10,7 @@ class Array
10
10
  else Integer(arg)
11
11
  end
12
12
  rescue ArgumentError
13
- raise "unknown digit: '#{arg}'"
13
+ raise " unknown digit: '#{arg}'"
14
14
  end
15
15
  end
16
16
  end
@@ -1,3 +1,3 @@
1
1
  module Calc24
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 24games
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,16 +9,18 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-21 00:00:00.000000000Z
12
+ date: 2011-09-06 00:00:00.000000000Z
13
13
  dependencies: []
14
- description: ! "\n computes an expression to solve the 24 game if possible.\n "
15
- email: takafan@hululuu.com
14
+ description: computes an expression to solve the 24 game if possible.
15
+ email:
16
+ - takafan@163.com
16
17
  executables:
17
18
  - 24games
18
19
  extensions: []
19
20
  extra_rdoc_files: []
20
21
  files:
21
22
  - .gitignore
23
+ - Gemfile
22
24
  - MIT-LICENSE
23
25
  - README.rdoc
24
26
  - Rakefile
@@ -29,11 +31,10 @@ files:
29
31
  - lib/calc24/ext.rb
30
32
  - lib/calc24/version.rb
31
33
  - spec/calc24_spec.rb
32
- homepage: http://github.com/takafan/24games"
34
+ homepage: http://github.com/takafan/24games
33
35
  licenses: []
34
36
  post_install_message:
35
- rdoc_options:
36
- - --charset=UTF-8
37
+ rdoc_options: []
37
38
  require_paths:
38
39
  - lib
39
40
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -47,10 +48,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
47
48
  requirements:
48
49
  - - ! '>='
49
50
  - !ruby/object:Gem::Version
50
- version: 1.3.6
51
+ version: '0'
51
52
  requirements: []
52
53
  rubyforge_project: 24games
53
- rubygems_version: 1.8.5
54
+ rubygems_version: 1.7.2
54
55
  signing_key:
55
56
  specification_version: 3
56
57
  summary: 24 game/Solve