Battle Analysis: Hexagon Grid Calculator


The Hexagon Grid is a cartesian coordinate system is used for hexagon math.

The hexagons are given a hexagon point coordinate using the hexagon center location on the hexagon grid.

Now, analytic geometry is used for all math calculations.

The Hexagon Grid Calculator (docs) calculates the adjacent hexagon coordinates

Movement is calculated by adjusting the coordinates:

Note: The movement to adjacent hexagons DOES NOT require a check to see if the column is even or odd.

Note: Some of the hexagon grid coordinates land on the center of hexside lines. This coordinate is used to record its terrain.

The Hexagon Grid Calculator can determine if the grid coordinate is a center or a hexside.

The Hexagon Map Calculator calculates the hexagon point:

The adjacent hexsides are calculated by adjusting the coordinates from the hexagon center point:

Hexagon Name

The wargame map has labels on the hexagons to identify them.

The hexagon name is calculated from the hexagon point coordinate (x,y).

Note: This hexagon name is NOT a coordinate.

As the mouse moves, the hexagon point coordinate is calculated from the pixels on the map.

The Hexagon Grid is a simple cartesian x,y coordinate system used for wargame calculations.

hexagon point coordinate (x,y) → hexagon name

hexagon name → hexagon point coordinate (x,y)

Zone of Control ZOC

Zone of Control is calculated using the unit's hexagon point. Although the unit is placed on the map, the location of the unit is an attribute of the unit.

 ZocCalculator.prototype.unitIsZOC = function(index) {
  var isZOC = false;
  var los = new LineOfSight();
  var unitForce = this.force.getUnitForce(index);
  for (var i = 0; i < this.force.units.length; i++) {
   var force = this.force.getUnitForce(i);
   los.setOriginAndEndPoint(this.force.getUnitHexagonPoint(index), this.force.getUnitHexagonPoint(i));
   if (los.getRange() == 1){
    if(force != unitForce){
     isZOC = true;
   return isZOC;

The wargame consists of several components: