Files
space_game_server/game/universe_array.rb
T
2025-10-02 15:31:30 -06:00

21 lines
420 B
Ruby

# 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