feat: strategic placement engines for AI players#37
Merged
Conversation
Enrich setup prompts so LLM players can reason strategically about settlement placement. Each legal vertex now shows adjacent resources with number tokens, total pip count, and port access. - Add board helpers: get_hex(), port_at_vertex(), pip_count() - Add annotate_vertex() to prompt.rs for rich per-vertex context - Add setup_strategy field to Personality with per-archetype strategies - Thread round number through Player::choose_settlement trait - Fix hardcoded round=1 in LlamafilePlayer, inject setup strategy - Deduplicate probability_dots: board_view.rs now uses board::pip_count Fixes #35 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Enrich annotate_vertex with per-decision spatial context so LLMs can reason about board position, not just resource quality: - Expansion potential: open adjacent vertices satisfying distance rule - Opponent proximity: other players' buildings on shared production hexes - Own buildings: player's existing settlements (useful in round 2) - Updated legend explaining all annotation fields Research showed the Diplomacy-style "per-decision relational context" pattern outperforms raw coordinate dumps for LLM spatial reasoning. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Merge origin/main to pick up refactor: redesign new game screen with rules config (#41). No conflicts -- that PR only touched UI files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Enrich setup prompts so LLM players can reason strategically about settlement placement during the setup phase. Previously, AI players received bare vertex coordinates like
(0, -2, N)with zero information about adjacent resources, probability, ports, or spatial relationships. Now each legal vertex shows:Ore(10), Sheep(2), Wood(9))2:1 Wheat port)Example annotation:
Also adds per-personality setup strategies injected into the prompt, and fixes the hardcoded
round=1bug inLlamafilePlayer.Changes:
board.rs: Addget_hex(),port_at_vertex(), publicpip_count()helpersboard_view.rs: Deduplicateprobability_dots-> useboard::pip_countprompt.rs: Addannotate_vertex()with resource, spatial, and expansion context; enrichsetup_settlement_promptwith legendpersonality.rs: Add optionalsetup_strategyfield +setup_strategy_text()method + built-in strategies for all 5 personalitiesmod.rs: Addround: u8toPlayer::choose_settlementtraitorchestrator.rs: Pass actual round number tochoose_settlementllamafile_player.rs: Use real round, inject strategy + player names into prompt_round: u8parameterdiplomat.toml/rusher.toml: Addsetup_strategyFixes #35
PR Type
Checklist
AI Usage
AI Model/Tool used: Claude Opus 4.6 via Claude Code
Any Additional AI Details you'd like to share: Implemented all sub-tasks from the issue plus spatial context enrichment based on research into LLM board game representations (Diplomacy-style per-decision relational context). Added 13 new tests covering all new functionality.