MrD
MrD

Reputation: 5086

MASON Create Grid of Objects

I am learning MASON and trying to build a Cellular Automaton. For my purpose, each cell in the grid (geometric cell) would need to act as a container to host other 'objects'. Ie: Cells of type of type A, cells of type b, etc.

For example, in a 5x5 grid, you could have:

Cell(0,0) contains 3 cells of type a and 2 cells of type b (Each a different instance of classes type a and type b) Cell (0,1) contains...

Etc...

As far as I can see, the default grid which MASON offers stored an integer in each cell.

// our own parameters for setting the grid size later on
    public IntGrid2D grid;

    public int gridWidth = 100;
    public int gridHeight = 100;

Any advice?

Upvotes: 0

Views: 107

Answers (1)

user1456845
user1456845

Reputation: 21

This can be done using SparseGrid2D which allows more than one object per cell. If you refer to the MASON Manual it gives 14 tutorials 2 of which are for a Cellular Automata such as Conway's game of life.

Upvotes: 1

Related Questions