+12
-0
@@ -206,4 +206,13 @@ // Generated code -- http://www.redblobgames.com/grids/hexagons/ | ||
| function indexOfHex(hexes, hex) { | ||
| return hexes.reduce(function(cur, val, index) { | ||
| if cur is -1 and val.q is hex.q and val.r is hex.r then index else cur | ||
| }, -1); | ||
| } | ||
| function neighbors(hex1, hex2) { | ||
| return indexOfHex(hex_ring(hex1, 1), hex2) > -1); | ||
| } | ||
| // Tests | ||
@@ -382,1 +391,4 @@ | ||
| exports.polygon_corners = polygon_corners; | ||
| exports.indexOfHex = indexOfHex | ||
| exports.neighbors = neighbors |
+1
-1
@@ -5,3 +5,3 @@ { | ||
| "description": "", | ||
| "version": "0.1.5", | ||
| "version": "0.1.6", | ||
| "license": "MIT", | ||
@@ -8,0 +8,0 @@ "homepage": "http://www.redblobgames.com/grids/hexagons/", |
12126
2.73%323
3.19%