I have to model a 15-puzzle game board in Ruby. As a representation, I chose to use a multidimensional array (as a classic 2x2 matrix) with rows and columns.
My question is: is it better to subclass Array
, in order to store all the relevant informations inside self
or is it better to create a new class, and internally use an instance variable to keep track of the multidim array?
The API is meant to be the same in both cases, my question is about the implementation.