twisty_puzzles 0.0.8 → 0.0.9
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.
- checksums.yaml +4 -4
- data/lib/twisty_puzzles/coordinate.rb +19 -0
- data/lib/twisty_puzzles/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3dfb23949825572c531ac7bfcea491151629f8673160605069b1793a827d961a
|
4
|
+
data.tar.gz: f343cc589e99ac129717f47a7b3dbe4dcb3d4a0cbcae2e0f8c42b12b22ad842c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fc20aef94e333318c53ee292b5418424ad8880cc2f8ff18c2102d0799d96728ccc9a98869269bf9c6a046174dcf5f71182cf6498021838d8772c18a7008cfe2
|
7
|
+
data.tar.gz: b79344d44bf6fd32cd9443c79405dcab052867a746e23fecc0b1496bd96b36fc6c4dd09d2a8c3d33389d7e5b5daaf0ca4a0552cce8948c59ac590da458c6150d
|
@@ -6,6 +6,7 @@ require 'twisty_puzzles/native'
|
|
6
6
|
|
7
7
|
module TwistyPuzzles
|
8
8
|
# Coordinate of a sticker on the cube.
|
9
|
+
# rubocop:disable Metrics/ClassLength
|
9
10
|
class Coordinate
|
10
11
|
def self.highest_coordinate(cube_size)
|
11
12
|
cube_size - 1
|
@@ -121,6 +122,23 @@ module TwistyPuzzles
|
|
121
122
|
from_indices(face, cube_size, m, m)
|
122
123
|
end
|
123
124
|
|
125
|
+
def self.face(face, cube_size)
|
126
|
+
neighbor_a, neighbor_b = face.neighbors[0..1]
|
127
|
+
coordinate_range(cube_size).collect_concat do |x|
|
128
|
+
coordinate_range(cube_size).map do |y|
|
129
|
+
from_face_distances(face, cube_size, neighbor_a => x, neighbor_b => y)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def self.layer(face, cube_size)
|
135
|
+
face.neighbors.zip(face.neighbors.rotate(1)).collect_concat do |neighbor, next_neighbor|
|
136
|
+
coordinate_range(cube_size).map do |i|
|
137
|
+
from_face_distances(neighbor, cube_size, face => 0, next_neighbor => i)
|
138
|
+
end
|
139
|
+
end + self.face(face, cube_size)
|
140
|
+
end
|
141
|
+
|
124
142
|
def self.edges_outside(face, cube_size)
|
125
143
|
face.neighbors.zip(face.neighbors.rotate(1)).collect_concat do |neighbor, next_neighbor|
|
126
144
|
1.upto(cube_size - 2).map do |i|
|
@@ -261,6 +279,7 @@ module TwistyPuzzles
|
|
261
279
|
rots
|
262
280
|
end
|
263
281
|
end
|
282
|
+
# rubocop:enable Metrics/ClassLength
|
264
283
|
|
265
284
|
# Coordinate of a sticker on the Skewb.
|
266
285
|
class SkewbCoordinate
|