24games 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -6
- data/Gemfile +4 -0
- data/README.rdoc +1 -1
- data/bin/24games +13 -7
- data/calc24.gemspec +10 -14
- data/lib/calc24/ext.rb +1 -1
- data/lib/calc24/version.rb +1 -1
- metadata +10 -9
data/.gitignore
CHANGED
data/Gemfile
ADDED
data/README.rdoc
CHANGED
data/bin/24games
CHANGED
@@ -6,12 +6,19 @@ require 'calc24'
|
|
6
6
|
require 'calc24/version'
|
7
7
|
|
8
8
|
begin
|
9
|
-
|
9
|
+
digits = []
|
10
10
|
|
11
|
-
|
12
|
-
digits = ARGV.to_i
|
11
|
+
raise Calc24::VERSION if ['--version', '-v'].include? ARGV[0]
|
13
12
|
|
14
|
-
|
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
|
data/calc24.gemspec
CHANGED
@@ -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 =
|
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 =
|
12
|
-
s.homepage =
|
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.
|
19
|
-
s.rubyforge_project = %q{24games}
|
15
|
+
s.rubyforge_project = "24games"
|
20
16
|
|
21
|
-
s.files
|
22
|
-
s.
|
23
|
-
s.
|
24
|
-
s.
|
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
|
data/lib/calc24/ext.rb
CHANGED
data/lib/calc24/version.rb
CHANGED
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.
|
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-
|
12
|
+
date: 2011-09-06 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
|
-
description:
|
15
|
-
email:
|
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:
|
51
|
+
version: '0'
|
51
52
|
requirements: []
|
52
53
|
rubyforge_project: 24games
|
53
|
-
rubygems_version: 1.
|
54
|
+
rubygems_version: 1.7.2
|
54
55
|
signing_key:
|
55
56
|
specification_version: 3
|
56
57
|
summary: 24 game/Solve
|