Data structure for Settlers of Catan map?

Posted by templatetypedef on Stack Overflow See other posts from Stack Overflow or by templatetypedef
Published on 2011-02-18T10:41:02Z Indexed on 2011/02/18 15:25 UTC
Read the original article Hit count: 530

Filed under:
|

Hello all-

A while back someone asked me if I knew of a nice way to encode the information for the game Settlers of Catan. This would require storing a hexagonal grid in a way where each hex can have data associated with it. More importantly, though, I would need some way of efficiently looking up vertices and edges on the sides of these hexagons, since that's where all the action is.

My question is this: is there a good, simple data structure for storing a hexagonal grid while allowing for fast lookup of hexagons, edges between hexagons, and vertices at the intersections of hexagons? I know that general structures like a winged-edge or quad-edge could do this, but that seems like massive overkill.

Thanks!

© Stack Overflow or respective owner

Related posts about data-structures

Related posts about game