Basically I am trying to group pieces that are in the same space for a
combat routine.
list 1 2
----------------------
I hope this helps. I want to find out what units are in the same space
so they attack factors and defence can be accumilated and the units can
have combat.
I'm still not sure I understand what that diagram represents, as far as a
data structure is concerned.
Perhaps, though, instead of visualizing some kind of grouping as you appear
to be doing, you might consider a 2D array representing the spaces
themselves, where the contents of each cell (space) in the array are a list
(or pair of lists, red and blue) of the units currently in that space. So,
for the example above, the cell at (2,4) would contain a list (or two)
consisting of two red units and one blue unit.
You could store pointers to the actual units in those lists, or you could
store some kind of identifiers or indexes so that you can go look them up in
the red and blue lists. Then you just use a double-loop through the 2D
matrix, resolving conflicts for each space separately. If your coordinate
space isn't toooo big, this would work pretty well, I think.
-Howard