Engine for managing hexagons in Javascript