title: How do I color a hexagonal grid such that it doesn't have neighbors of the same color?
body: <p>I have a javascript app that generates a hex grid. Each hex is pointy topped with three variables for each of the cube coordinates (x, y &amp; z). I also have an array with three hex sprites.</p>
  
  <p>I've tried <code>sprite = sprites[hex.x&amp;3]</code>, which produces neat rows of hexes. I have also tried to offset the rows depending on the column via <code>sprite = sprites[(hex.x + hex.y&amp;3)&amp;3]</code> but that didn't work. I'm currently fiddling with the formula with little success.</p>
  
  <p>I know for a fact that I need no less than three sprites to do this, but I can't find a way to combine the three cube coordinates to show the correct sprite on the array :(</p>