← 返回 Skills 市场
81
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install civ6-adjacency-optimizer-hex-grid-spatial
功能描述
Hex grid spatial utilities for offset coordinate systems. Use when working with hexagonal grids, calculating distances, finding neighbors, or spatial queries...
使用说明 (SKILL.md)
Hex Grid Spatial Utilities
Utilities for hexagonal grid coordinate systems using odd-r offset coordinates (odd rows shifted right).
Coordinate System
- Tile 0 is at bottom-left
- X increases rightward (columns)
- Y increases upward (rows)
- Odd rows (y % 2 == 1) are shifted right by half a hex
Direction Indices
2 1
\ /
3 - * - 0
/ \
4 5
0=East, 1=NE, 2=NW, 3=West, 4=SW, 5=SE
Core Functions
Get Neighbors
def get_neighbors(x: int, y: int) -> List[Tuple[int, int]]:
"""Get all 6 neighboring hex coordinates."""
if y % 2 == 0: # even row
directions = [(1,0), (0,-1), (-1,-1), (-1,0), (-1,1), (0,1)]
else: # odd row - shifted right
directions = [(1,0), (1,-1), (0,-1), (-1,0), (0,1), (1,1)]
return [(x + dx, y + dy) for dx, dy in directions]
Hex Distance
def hex_distance(x1: int, y1: int, x2: int, y2: int) -> int:
"""Calculate hex distance using cube coordinate conversion."""
def offset_to_cube(col, row):
cx = col - (row - (row & 1)) // 2
cz = row
cy = -cx - cz
return cx, cy, cz
cx1, cy1, cz1 = offset_to_cube(x1, y1)
cx2, cy2, cz2 = offset_to_cube(x2, y2)
return (abs(cx1-cx2) + abs(cy1-cy2) + abs(cz1-cz2)) // 2
Tiles in Range
def get_tiles_in_range(x: int, y: int, radius: int) -> List[Tuple[int, int]]:
"""Get all tiles within radius (excluding center)."""
tiles = []
for dx in range(-radius, radius + 1):
for dy in range(-radius, radius + 1):
nx, ny = x + dx, y + dy
if (nx, ny) != (x, y) and hex_distance(x, y, nx, ny) \x3C= radius:
tiles.append((nx, ny))
return tiles
Usage Examples
# Find neighbors of tile (21, 13)
neighbors = get_neighbors(21, 13)
# For odd row: [(22,13), (22,12), (21,12), (20,13), (21,14), (22,14)]
# Calculate distance
dist = hex_distance(21, 13, 24, 13) # Returns 3
# Check adjacency
is_adj = hex_distance(21, 13, 21, 14) == 1 # True
# Get all tiles within 3 of city center
workable = get_tiles_in_range(21, 13, 3)
Key Insight: Even vs Odd Row
The critical difference is in directions 1, 2, 4, 5 (the diagonal directions):
| Direction | Even Row (y%2==0) | Odd Row (y%2==1) |
|---|---|---|
| NE (1) | (0, -1) | (1, -1) |
| NW (2) | (-1, -1) | (0, -1) |
| SW (4) | (-1, +1) | (0, +1) |
| SE (5) | (0, +1) | (1, +1) |
East (0) and West (3) are always (1, 0) and (-1, 0).
安全使用建议
This skill appears to be a straightforward, local hex-grid math utility and does not ask for credentials, network access, or installs. If you plan to use it in production, confirm the source/author (no homepage provided), review the small Python file to ensure it meets your needs, and run it in your normal code-review or sandbox workflow. If provenance is important, ask the publisher for a homepage, license, or additional metadata before wide deployment.
功能分析
Type: OpenClaw Skill
Name: civ6-adjacency-optimizer-hex-grid-spatial
Version: 0.1.0
The skill bundle provides standard hexagonal grid utility functions (distance, neighbors, range) for the 'odd-r' offset coordinate system used in games like Civilization VI. The code in scripts/hex_utils.py consists of pure mathematical logic with no external dependencies, file I/O, or network access, and the SKILL.md documentation contains no malicious instructions or prompt injection attempts.
能力评估
Purpose & Capability
Name/description, SKILL.md and the included Python module all describe hex grid utilities (odd-r offset) and the required functions (neighbors, distance, range). The registry slug mentioning Civ6 is consistent with the module docstring and examples.
Instruction Scope
SKILL.md contains only function documentation, examples, and algorithms for hex math; it does not instruct the agent to read system files, call external endpoints, or access environment variables.
Install Mechanism
No install spec is present (instruction-only with a single Python source file). Nothing is downloaded or written to disk by an installer.
Credentials
The skill requires no environment variables, credentials, or config paths; the operations are purely computational and do not need secrets or external service access.
Persistence & Privilege
always is false and the skill does not request persistent system-level privileges or modify other skills; autonomous invocation is allowed by default but not combined with other high-risk signals.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install civ6-adjacency-optimizer-hex-grid-spatial - 安装完成后,直接呼叫该 Skill 的名称或使用
/civ6-adjacency-optimizer-hex-grid-spatial触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.0
Bulk publish from all-task-skills-dedup
元数据
常见问题
hex-grid-spatial 是什么?
Hex grid spatial utilities for offset coordinate systems. Use when working with hexagonal grids, calculating distances, finding neighbors, or spatial queries... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 81 次。
如何安装 hex-grid-spatial?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install civ6-adjacency-optimizer-hex-grid-spatial」即可一键安装,无需额外配置。
hex-grid-spatial 是免费的吗?
是的,hex-grid-spatial 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
hex-grid-spatial 支持哪些平台?
hex-grid-spatial 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 hex-grid-spatial?
由 wu-uk(@wu-uk)开发并维护,当前版本 v0.1.0。
推荐 Skills