ruby_terminal_games 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9774eb8d88de85447adbc2f20a836a599431ae54
|
4
|
+
data.tar.gz: 8f9bab9e0d7082f134cbda20b10ddfc41a1b6ab1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4d3b0ddbb56c63c43f8feb68ca97fbc26fd3bf81695d519acedbb73ecb77cb7abe8bd3fd49b9850c07084956681569d4b9d50ee0b7ee68e292c6f33d789d5e3
|
7
|
+
data.tar.gz: 8f75f774d941de0158c0d266d9c02a115a2201a3258e183f089ab16e0470ee1ac18bead9e40ad88f1502994c6061527aa3b2a1ee893ddd36d4c6d14eda903fb6
|
@@ -32,7 +32,7 @@ module RubyTerminalGames
|
|
32
32
|
def died?
|
33
33
|
_, position = state.last
|
34
34
|
row, col = position
|
35
|
-
across_rows_limit?(row) || across_cols_limit?(col)
|
35
|
+
across_rows_limit?(row) || across_cols_limit?(col) || collision_with_self?
|
36
36
|
end
|
37
37
|
|
38
38
|
def eat?(apple)
|
@@ -75,6 +75,10 @@ module RubyTerminalGames
|
|
75
75
|
def used_positions
|
76
76
|
state.map { |s| s.last }
|
77
77
|
end
|
78
|
+
|
79
|
+
def collision_with_self?
|
80
|
+
used_positions.uniq.size != used_positions.size
|
81
|
+
end
|
78
82
|
end
|
79
83
|
end
|
80
84
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_terminal_games
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Alves
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses
|