working more
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
# Nathan Hinton 1 Oct 2025
|
||||
# Create a custom hash class for the universe.
|
||||
|
||||
require './position'
|
||||
|
||||
# This will contain the universe hash inside it. It will allow for array type
|
||||
# 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]
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user