hex-grid-spatial

Compute neighbors, distances, and ranges on odd-r offset hex grids.

4|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/GeneralReasoning/env-skillsbench --skill hex-grid-spatial-generalreasoning
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hex-grid-spatial
Source: https://github.com/GeneralReasoning/env-skillsbench/tree/main/civ6-adjacency-optimizer/environment/skills/hex-grid-spatial
Command: npx skills add https://github.com/GeneralReasoning/env-skillsbench --skill hex-grid-spatial-generalreasoning

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This set of pure-Python utilities provides reliable, fast calculations on offset hex grids (odd-r), including neighbor lookup, distance measurement, adjacency checks, and range queries to support map-based logic and tactical computations.

Core Features & Use Cases

  • Get Neighbors: retrieve all six adjacent hex coordinates for any tile, enabling neighbor-aware traversal and flood-fill.
  • Hex Distance: compute distance between two hex tiles using offset-to-cube conversion for accurate path length.
  • Tiles in Range: enumerate all tiles within a given radius around a center tile for range-based queries.
  • Adjacency & Direction: check adjacency and obtain directional relations between tiles to support navigation logic.
  • Use Case: powers hex-map based strategy games, tile-based simulations, and procedural map analysis with consistent, deterministic results.

Quick Start

Call get_neighbors on a tile to list its six adjacent coordinates.

Frequently Asked Questions about hex-grid-spatial

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I calculate hex grid distance on odd-r offset coordinates?

Hex grid distance on odd-r offset coordinates is calculated using offset-to-cube conversion to accurately measure path length between two hex tiles. This pure-Python utility provides the hex_distance function for deterministic results.

How do I get all six neighbors of a hex tile in a strategy game map?

To get all six neighbors of a hex tile in a strategy game map, use the get_neighbors function which retrieves adjacent hex coordinates for odd-r offset grids. It enables neighbor-aware traversal and flood-fill operations.

What is the best way to find all hex tiles within a specific range radius?

The best way to find all hex tiles within a specific range radius is using the get_tiles_in_range function. It enumerates all surrounding tiles around a center coordinate for range-based queries in hex-grid simulations.

Can I check adjacency and directional relations between hex tiles in pure Python?

Yes, you can check adjacency and obtain directional relations between hex tiles in pure Python using the is_adjacent function. It supports navigation logic on odd-r offset hex grids with deterministic outputs.

Do I need external dependencies to perform hex-grid neighbor and range queries?

No external dependencies are needed to perform hex-grid neighbor and range queries. This skill uses pure-Python implementations relying solely on the standard library, ensuring fast lookups without installation barriers.

Are these hex-grid spatial calculations suitable for Civ6-style map simulations?

These hex-grid spatial calculations are suitable for Civ6-style map simulations and tile-based strategy games. They provide consistent, deterministic results for procedural map analysis and tactical computations on odd-r offset layouts.