Cleaning up and writing tests

This commit is contained in:
2025-10-02 21:45:52 -06:00
parent ed3cd08130
commit 279658f3e5
17 changed files with 584 additions and 56 deletions
+9 -2
View File
@@ -7,12 +7,19 @@ require './position'
# indexing as well as point type indexing
class UniverseArray < Array
def initialize
super
end
def [](index, *rest)
if index.is_a?(Position)
return self[position.y_pos][position.x_pos]
return self[index.y_pos][index.x_pos]
else
super
end
end
def []=(index, *rest)
if index.is_a?(Position)
return self[index.y_pos][index.x_pos] = rest[0]
else
super
end