array-symmetries 0.0.5 → 0.0.6
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/array.rb +2 -0
- 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: 3ba87b7e100d78700aac96958863b042f5cd05aaca9d25fedcf0e07ebe3ad393
|
4
|
+
data.tar.gz: 365c4cfdc9a803b1bb5464b8588167e2643344a18df4865584e86a33b9970629
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09a286c72391226bc9ef83cfd9f29b4745f5291a90cb40d7f1889de1f57b2566332c65248d438a9fe48ef87a3c8fc664b30f179c6340c4393dc5921baeaba269'
|
7
|
+
data.tar.gz: 2f6b743e7c2014c672111f7165633ae936f24723aaa3ad4d70cf88ce3b5c4ee3d0e5ec0f39dbc3a4597f1bab29901a79777b8fcfe428e1180aa00b12958e920d
|
data/lib/array.rb
CHANGED
@@ -32,6 +32,7 @@ class Array # yeah it's a monkey patch
|
|
32
32
|
[[first.first, first.last], [last.first, last.last]]
|
33
33
|
end
|
34
34
|
|
35
|
+
# Return a square array in which each entry is its own coordinates, i.e. [rol, col]
|
35
36
|
def self.coord_square(n)
|
36
37
|
return ArgumentError unless n.is_a?(Integer) && n > 0
|
37
38
|
Array.new(n) do |i|
|
@@ -41,6 +42,7 @@ class Array # yeah it's a monkey patch
|
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
45
|
+
# Return the array of the eight symmetries of the coordinates square
|
44
46
|
def self.patterns(n)
|
45
47
|
coord_square(n).symmetries
|
46
48
|
end
|