terminal_game_of_life 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/game_of_life.gemspec +1 -13
- data/lib/game_of_life/generators/input.rb +1 -1
- data/lib/game_of_life/generators/seed.rb +2 -2
- data/lib/game_of_life/version.rb +1 -1
- data/lib/game_of_life.rb +3 -3
- metadata +4 -143
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7c06d9b3fa0064f9909d6a6fa9e074d5d19c986864b39c4bcb5e894e2f95797
|
4
|
+
data.tar.gz: 45ceec6d3597e6a25321e9d2e16aa4514854842cbd5a78fac56a6c391d4b0e43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17eb17da0045de01fd74edf451984086eaf9f8ea3d0f79b43c5224261abc59cc771638ade18b29a10c948c08157bc836ace1e97224b9e4e9eac4b61783410248
|
7
|
+
data.tar.gz: 06a25e28dadc410701131cc71eefbd7f3a411d706640029add6478317463922e28db728051e2b6c57acc2c9ac46921e2e7fa179a2f61da1b676636e2c0de7bcf
|
data/game_of_life.gemspec
CHANGED
@@ -19,23 +19,11 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.metadata["source_code_uri"] = "https://git.sr.ht/~a14m/game-of-life/tree/master/CLI/ruby"
|
20
20
|
spec.metadata["documentation_uri"] = "https://rubydoc.info/gems/terminal_game_of_life"
|
21
21
|
spec.metadata["changelog_uri"] = "https://git.sr.ht/~a14m/game-of-life/tree/master/CLI/ruby/CHANGELOG.md"
|
22
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
22
23
|
|
23
24
|
spec.executables = ["game-of-life"]
|
24
25
|
spec.require_paths = ["lib"]
|
25
26
|
spec.files = Dir["README.md", "game_of_life.gemspec", "bin/game-of-life", "lib/**/*.rb", ".yardopts"]
|
26
27
|
|
27
28
|
spec.add_dependency "thor", "~> 1.0"
|
28
|
-
|
29
|
-
spec.add_development_dependency "bundler"
|
30
|
-
spec.add_development_dependency "pry-byebug"
|
31
|
-
spec.add_development_dependency "rake"
|
32
|
-
spec.add_development_dependency "rspec"
|
33
|
-
spec.add_development_dependency "rubocop"
|
34
|
-
spec.add_development_dependency "rubocop-rspec"
|
35
|
-
# Code Coverage dependencies
|
36
|
-
spec.add_development_dependency "json"
|
37
|
-
spec.add_development_dependency "simplecov"
|
38
|
-
# Documentation dependencies
|
39
|
-
spec.add_development_dependency "redcarpet"
|
40
|
-
spec.add_development_dependency "yard"
|
41
29
|
end
|
@@ -54,7 +54,7 @@ module GameOfLife
|
|
54
54
|
(0...height).each do |i|
|
55
55
|
(0...width).each do |j|
|
56
56
|
cell = { x: j, y: i, alive: input.fetch(i, nil)&.fetch(j, nil) }
|
57
|
-
universe[i][j] = ::GameOfLife::Cell.new(cell)
|
57
|
+
universe[i][j] = ::GameOfLife::Cell.new(**cell)
|
58
58
|
end
|
59
59
|
end
|
60
60
|
universe
|
@@ -32,7 +32,7 @@ module GameOfLife
|
|
32
32
|
# Create a pseudo(stable) random generator from the seed
|
33
33
|
# Generate a sequence of bytes to cover the Game of Life Universe plane
|
34
34
|
# each byte can be unpacked into binary data string (ex. "01101011")
|
35
|
-
raw = Random.new(seed).bytes(width * height).unpack1("B*").
|
35
|
+
raw = Random.new(seed).bytes(width * height).unpack1("B*").chars.each_slice(width)
|
36
36
|
raw.map { |row| row.map { |char| char.eql?("1") } }
|
37
37
|
end
|
38
38
|
|
@@ -48,7 +48,7 @@ module GameOfLife
|
|
48
48
|
(0...height).each do |i|
|
49
49
|
(0...width).each do |j|
|
50
50
|
cell = { x: j, y: i, alive: input.fetch(i, nil)&.fetch(j, nil) }
|
51
|
-
universe[i][j] = ::GameOfLife::Cell.new(cell)
|
51
|
+
universe[i][j] = ::GameOfLife::Cell.new(**cell)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
universe
|
data/lib/game_of_life/version.rb
CHANGED
data/lib/game_of_life.rb
CHANGED
@@ -36,11 +36,11 @@ module GameOfLife
|
|
36
36
|
end
|
37
37
|
if (options["width"]&.< 1) || (options["width"]&.> max_width)
|
38
38
|
fail GameOfLife::Error, "Invalid --width value. " \
|
39
|
-
|
39
|
+
"must be between 1 and #{max_width} (current terminal width)"
|
40
40
|
end
|
41
41
|
if (options["height"]&.< 1) || (options["height"]&.> max_height)
|
42
42
|
fail GameOfLife::Error, "Invalid --height value. " \
|
43
|
-
|
43
|
+
"must be between 1 and #{max_height} (current terminal height)"
|
44
44
|
end
|
45
45
|
|
46
46
|
fail GameOfLife::Error, "Invalid --live-cell value. must be a single character" if options["live-cell"].length > 1
|
@@ -111,7 +111,7 @@ module GameOfLife
|
|
111
111
|
# Ref: https://stackoverflow.com/questions/11023929/using-the-alternate-screen-in-a-bash-script
|
112
112
|
# Ref: https://superuser.com/questions/122911/what-commands-can-i-use-to-reset-and-clear-my-terminal
|
113
113
|
print "\e[?1049h\e[H"
|
114
|
-
print universe
|
114
|
+
print universe
|
115
115
|
print "\n #{BANNER}"
|
116
116
|
sleep(DELAY / 1000.0)
|
117
117
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terminal_game_of_life
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- a14m
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -24,146 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: pry-byebug
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rspec
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rubocop
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop-rspec
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: json
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: simplecov
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: redcarpet
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ">="
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - ">="
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: yard
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - ">="
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - ">="
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
167
27
|
description: Conway's game of life implementation as a CLI ruby gem.
|
168
28
|
email:
|
169
29
|
- a14m@pm.me
|
@@ -192,6 +52,7 @@ metadata:
|
|
192
52
|
source_code_uri: https://git.sr.ht/~a14m/game-of-life/tree/master/CLI/ruby
|
193
53
|
documentation_uri: https://rubydoc.info/gems/terminal_game_of_life
|
194
54
|
changelog_uri: https://git.sr.ht/~a14m/game-of-life/tree/master/CLI/ruby/CHANGELOG.md
|
55
|
+
rubygems_mfa_required: 'true'
|
195
56
|
post_install_message:
|
196
57
|
rdoc_options: []
|
197
58
|
require_paths:
|
@@ -207,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
68
|
- !ruby/object:Gem::Version
|
208
69
|
version: '0'
|
209
70
|
requirements: []
|
210
|
-
rubygems_version: 3.
|
71
|
+
rubygems_version: 3.4.10
|
211
72
|
signing_key:
|
212
73
|
specification_version: 4
|
213
74
|
summary: Game of Life CLI
|