hex_chess_engine
- hex_chess_engine.new_game(white_player='', black_player='star')
Build a fresh Loopmother Chess state dict. # 👑👑
The state is plain JSON-serializable data: piece keys are stored as strings when serialized (Redis JSON), but the engine normalizes them back to ints via
_pieces()on every read.
- hex_chess_engine.is_valid_tile(tile)
True when the tile exists on the 8x8 lattice.
- hex_chess_engine.is_void(pieces, voids, tile)
True when the tile has been consumed by the void.
- hex_chess_engine.enemy_color(color)
The binary collapses as designed.
- hex_chess_engine.find_queens(pieces, color)
Locate every surviving queen of color.
- hex_chess_engine.is_threatened(pieces, voids, tile, by_color)
True when any by_color piece attacks tile. Knight spiral drift is ignored for threat math (as in the original).
- hex_chess_engine.render_board(state)
Render the spiral lattice as an emoji board. # 👑🦄🔮🦂💀
Every cell is two emoji (color chip + piece, or doubled terrain) so columns stay aligned in chat clients.
- hex_chess_engine.rules_cheatsheet()
The Stargazer cheat sheet — injected with the board every prompt.
- Return type:
- hex_chess_engine.execute_action(state, action)
Parse and execute one game action against state (mutated in place).
- Parameters:
- Returns:
{"ok": bool, "message": str, "board": str, "game_over": bool, "winner": str | None}. The caller is responsible for persisting state back to Redis whenok.- Return type: