golr 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/bin/golr +20 -7
- data/lib/golr/version.rb +1 -1
- metadata +26 -20
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NTVjODAzZDM4N2Q4NDY2YTE4OTM4NjhjYzBhYzgxNjkwODRjNjFlNA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MjEwNWRiNTE5ZTNiZDRhMjM1OWY3N2YyMTliYWY2NDAwMWUwODVjZQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YTliMjE5M2IzMjAyNWI3NGVhZjliZTViMDE5ZDBiYjlkZTg1ZGQ4ZjkzODY3
|
10
|
+
MjMyZjc1NmM0M2MyNDY4YTVlZjUyZjA0MWY5OGRhMjM2NjA3MWEzMTM3YTBm
|
11
|
+
Y2ZhZjViNThjNTAwODZlZGIwZjg4MTJiYTBhMWViOTcyY2FiYzM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YmYyZDkwMDBkZjEyNTk4MmU5Yzk4NWVmNGM0NzZkOGUwZDMwZGMzYjQ5ODUx
|
14
|
+
ZmIxNmEwMzNhNTk3MDBlODgyYzU0NDNlMzBjZmYyZDRkOWFmOTQyNDFhNDJm
|
15
|
+
MGM3YTcyMDkyYmQ2Y2MyMGNhNjQzMDBhMjlkZWU4Yjg5NWIxYWU=
|
data/bin/golr
CHANGED
@@ -19,6 +19,9 @@ optparse = OptionParser.new do |opts|
|
|
19
19
|
opts.on("-g", "--generations [NUMBER]", "Evolve game through this many generations [defaults to 100]") do |g|
|
20
20
|
options[:generations] = g.to_i
|
21
21
|
end
|
22
|
+
opts.on("--time-only", "Do not produce game output, just total runtime for benchmarking") do |time_only|
|
23
|
+
options[:time_only] = true
|
24
|
+
end
|
22
25
|
end
|
23
26
|
|
24
27
|
optparse.parse!
|
@@ -26,7 +29,10 @@ optparse.parse!
|
|
26
29
|
# load game from file
|
27
30
|
game_file = ARGV[0]
|
28
31
|
begin
|
29
|
-
|
32
|
+
if game_file.nil?
|
33
|
+
puts "You have to specify a game file. Try 'golr -h' for help"
|
34
|
+
exit 1
|
35
|
+
end
|
30
36
|
game_string = File.read(game_file)
|
31
37
|
game = Golr::GameReader.from_string(game_string)
|
32
38
|
rescue Errno::ENOENT, Errno::EACCES => e
|
@@ -36,12 +42,19 @@ end
|
|
36
42
|
|
37
43
|
# evolve through generations
|
38
44
|
generations = options[:generations]
|
39
|
-
puts 'Generation #0'
|
40
|
-
Golr::GamePrinter.print(game)
|
41
45
|
generation = 1
|
42
|
-
|
43
|
-
|
44
|
-
|
46
|
+
|
47
|
+
if options[:time_only]
|
48
|
+
time_then = Time.new
|
49
|
+
generations.times.each { game.evolve; generation += 1 }
|
50
|
+
puts "#{Time.now - time_then}s elapsed for #{generation - 1} generations"
|
51
|
+
else
|
52
|
+
puts 'Generation #0'
|
45
53
|
Golr::GamePrinter.print(game)
|
46
|
-
|
54
|
+
generations.times.each do
|
55
|
+
game.evolve
|
56
|
+
puts "Generation \##{generation}"
|
57
|
+
Golr::GamePrinter.print(game)
|
58
|
+
generation += 1
|
59
|
+
end
|
47
60
|
end
|
data/lib/golr/version.rb
CHANGED
metadata
CHANGED
@@ -1,52 +1,46 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: golr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Markus Krogemann
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-09-28 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rspec
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: 2.
|
19
|
+
version: 2.14.1
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: 2.
|
26
|
+
version: 2.14.1
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: cucumber
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version: 1.3.
|
33
|
+
version: 1.3.8
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version: 1.3.
|
40
|
+
version: 1.3.8
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: simplecov
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,11 +48,24 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: 0.7.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: metric_fu
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 4.4.4
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 4.4.4
|
62
69
|
description: Offers methods to initialize and evolve a grid of cells, implementing
|
63
70
|
the rules of Conway's Game of Life
|
64
71
|
email:
|
@@ -68,37 +75,36 @@ executables:
|
|
68
75
|
extensions: []
|
69
76
|
extra_rdoc_files: []
|
70
77
|
files:
|
71
|
-
- lib/golr/key.rb
|
72
|
-
- lib/golr/game_printer.rb
|
73
|
-
- lib/golr/rules.rb
|
74
78
|
- lib/golr/game.rb
|
79
|
+
- lib/golr/game_printer.rb
|
75
80
|
- lib/golr/game_reader.rb
|
81
|
+
- lib/golr/key.rb
|
82
|
+
- lib/golr/rules.rb
|
76
83
|
- lib/golr/version.rb
|
77
84
|
- lib/golr.rb
|
78
85
|
- bin/golr
|
79
86
|
homepage: https://github.com/mkrogemann/golr
|
80
87
|
licenses:
|
81
88
|
- MIT
|
89
|
+
metadata: {}
|
82
90
|
post_install_message:
|
83
91
|
rdoc_options: []
|
84
92
|
require_paths:
|
85
93
|
- lib
|
86
94
|
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
-
none: false
|
88
95
|
requirements:
|
89
96
|
- - ! '>='
|
90
97
|
- !ruby/object:Gem::Version
|
91
98
|
version: '0'
|
92
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
-
none: false
|
94
100
|
requirements:
|
95
101
|
- - ! '>='
|
96
102
|
- !ruby/object:Gem::Version
|
97
103
|
version: '0'
|
98
104
|
requirements: []
|
99
105
|
rubyforge_project:
|
100
|
-
rubygems_version:
|
106
|
+
rubygems_version: 2.0.3
|
101
107
|
signing_key:
|
102
|
-
specification_version:
|
108
|
+
specification_version: 4
|
103
109
|
summary: Conway's Game of Life
|
104
110
|
test_files: []
|