Phase 5.1a — ActionGroup backward-compat in AbilitySystem:
- Add GetEffectiveActions(def): prefers ActionGroup.Actions (AND=sequential,
OR/XOR=random pick); falls back to obsolete def.Actions for pre-Phase-1 rows.
- Wire all FireAbility, FireCardEffects, FireTrigger, FireRuinAbilities call
sites to use GetEffectiveActions instead of def.Actions directly.
Phase 5.9 — 12 new EvaluateCondition cases (§6.6):
UnitTypeIs, OwnershipIs, IsThisCard, UnitPropertyCompare, PlayerPropertyCompare,
HandContainsCount, CardDefinitionCountInZone, IsInRangeOfUnit, TileOccupant,
SurroundingTile, SPAccumulationCompare, CostOfCardsInHand.
Add CompareInt(Comparator, int, int) helper to DRY up comparator switch.
Phase 6-D — Fix double-fire of source Ruin's OnRuinActivation abilities:
Insert source-skip guard in FireTrigger after TriggerMatches check:
skip OnRuinActivationTrigger on the card whose InstanceId == occurrence.Data.SourceId.
FireRuinAbilities already executed the chosen ability directly; the subsequent
FireTrigger is only for observer cards.
Phase 6-C — Ruin tile placement must not overwrite existing Ruins (GameEngine.cs):
Add `&& t.RuinId == null` to the validTiles Where clause.
Change error code NO_VALID_TILE → NO_VALID_RUIN_TILE for this path.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
- Replace tab navigation with Bootstrap accordion (all sections open by default)
- Type-contextual Stats section: ArchSpirit+Spirit+SpiritToken show combat/movement/
flags/genus; Terramorpha shows mode selector; Repentance/Instinct show RequiresLOS
checkbox only with note about ArchSpirit LOS origin (Resolved Decision #6)
- CanBeSacrificed flag hidden for ArchSpirit (Spirit and SpiritToken only)
- Section completion badges: green check when Name filled / abilities JSON present /
assets added
- Abilities section badge shows constraint reminder for Repentance/Instinct
- Replace _tabs string array with _openSections HashSet + ToggleSection helper
- Remove stale EffectsJson/CardType branching in save logic (already done Phase 2)
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
- Add CardType.SpiritToken enum value (stored as text, no Postgres enum change)
- Drop catalog.card_definitions.effects column (migration 20260419170135)
with safety-pass to copy any remaining effects -> abilities before drop
- Remove CardDefinition.EffectsJson property and CatalogDbContext mapping
- Remove CardInstance.EffectsJson snapshot from GameState/GameEngine
- Remove EffectsJson from all DTOs: UnitDelta, CardUpdateDto, ContentCardDto
- Remove EffectsJson from GameStateDiffer, ContentDtoMapper, CardEditor, CardReport
- Simplify AbilitySystem.FireCardEffects to use AbilitiesJson only (no fallback)
- Enforce SpiritToken exclusion in CollectionAddCardHandler (deck builds)
- Enforce SpiritToken exclusion in BazaarBuyBoosterPackHandler (pack draws)
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
AiMatchService:
- GetActiveMatchesAsync: queries CustomLobbies joined to GameSessions
to return all running AI vs AI sessions with display names.
- ForceEndMatchAsync: marks session Abandoned + lobby Completed; the AI
polling loops detect the status change within ~1 s and exit cleanly.
- ActiveAiMatch DTO returned by both methods.
AiMatchPage:
- Active AI Matches section loads on page init and has a Refresh button;
each row has an End button that calls ForceEndMatchAsync and refreshes.
- Created This Session table also gets an End button per row.
- Spinner shown on the End button while the request is in flight.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
AiMatchPage:
- Add Grid Type dropdown (Square / Hexagon) and HexSides input (shown
only when Hexagon selected) to the Board section, wired to GridType
and HexSides in GameRules.
- Add SameAi computed property: true when both players share the same
difficulty + strategy (i.e. resolve to the same account GUID).
- Show a warning banner and disable the Create button when SameAi,
preventing the broken game state that occurs when a player is matched
against itself.
AiMatchService:
- Server-side guard: throw ArgumentException if id1 == id2 so the
broken state is impossible even if the UI check is bypassed.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
AiTurnContext.OpponentIds was everyone-except-self, so in team games the
AI would attack its own allies and score them as enemy material. The game
model already has TeamIndex on PlayerState and GameState.GetEnemyIds() /
AreAllies() helpers — the AI just never used them.
- AiTurnContext: use state.GetEnemyIds() so OpponentIds excludes allies
(fixes attack targeting, threat detection, positional advance)
- MaterialScore: use state.AreAllies() so allied units/ArchSpirit score
positively instead of as enemy material
- PositionalScore: skip allied players when collecting enemy positions
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
- Track active effects with human-readable labels in AbilitySystem
(LabelFromReversal/LabelFromTick for stat mods, status flags, DOT/HOT)
- Add ActiveEffectDto to GameStateDto and GameStateDelta; delta now
always includes the full effects list so clients are never stale
- Add ResolveLabelFromEffectJson fallback for effects stored before the
Label field was introduced (old game sessions show correct labels)
- Client _append_active_effect_lines helper filters activeEffects by
targetRef and appends formatted lines to the tile drawer for spirits,
archspirits, spirit tokens, and ruins
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
MaterialScore only tracked the ArchSpirit's HP ratio. Permanent stat-buff
abilities (attack, defence, movement) produced no score gain after the
simulation, so they always lost to their ST cost (-8 ResourceScore) and
were never chosen.
Add per-point weights for Damage (×10), MaxDefense (×8), and MaxMp (×6)
on the ArchSpirit. Each weight exceeds the ResourceScore cost of 1 ST (8
pts), so a 1-ST buff ability now registers as a net positive and the
greedy engine will choose it when no stronger action is available.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
When an ability activation raised the score baseline significantly (e.g.
bouncing a unit, dealing damage, healing), no subsequent move or attack
could beat that new baseline, so the AI ended its turn after just one
action leaving all other units idle.
Two-part fix:
1. Relax the selection threshold by NoRegressTolerance (1.0 pts) so that
moves/attacks that are near-neutral still qualify as candidates.
2. Track serialised-state hashes for every state seen during the turn;
candidates that would revisit a prior state are skipped, preventing
the tolerance from enabling intra-turn cycles.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Previously assumed each sacrifice always yields +1 ST regardless of the
unit's costs or the player's running ST total. Now calls
SacrificeSystem.GetSacrificeValue / GetSTReturn exactly as the engine
does, and respects FixedSacrificeReturn overrides. The projected ST
total is accumulated unit-by-unit so the diminishing-return curve is
correctly applied.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Spectators were receiving game.state_delta in the normal delta path,
but the client only handles game.state_update for spectator views.
Always push a full game.state_update to spectators so they see every
turn change without needing to reconnect.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
The old scoring only gave +15 when a unit was already adjacent to the enemy
ArchSpirit — no reward for closing distance from further away. This caused
both AIs to settle into a static local optimum far from each other and never
advance (observed at turn 171 with armies on opposite sides of the board).
Adds a continuous gradient: +20×(1-dist/maxDist) per unit toward enemy
ArchSpirit and +8×(1-dist/maxDist) toward nearest enemy unit. Each step
forward now gives a small positive score improvement, so the greedy engine
always has a reason to advance when no better action exists.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
AiMatchPage now includes all custom rule fields (opening hand, SP, board size,
shape, deck limits, timers, MP buff, etc.) matching the options available in
custom lobbies. AiMatchService.CreateMatchAsync accepts an optional GameRules
parameter. Reset to Default button restores standard ruleset.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
The restore stage only copies explicit .csproj files before running
dotnet restore. The new SOR.Networking.Nats project reference added to
SOR.Admin was missing, causing NETSDK1004 (assets file not found) at publish.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Removes game.ai.create_match WebSocket handler (no longer accessible to clients)
and replaces it with AiMatchService injected directly into a new admin Blazor
page at /ai/matches. Admin portal gains NATS publish capability (SOR.Networking.Nats
project reference + AddNats) so AiMatchService can emit GameStartedEvent to trigger
AiPlayerSessionManager. AiDeckResolver is made public for admin injection.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Adds GameAiMatchHandler (game.ai.create_match) that creates a spectatable
AI-vs-AI match without a human lobby. Resolves AI accounts and decks,
builds a minimal CustomLobby with AiSlotsJson, creates a GameSession, and
publishes GameStartedEvent so AiPlayerSessionManager starts both polling loops.
Client receives { sessionId, player1Name, player2Name } and sends game.spectate
to watch via the existing spectator infrastructure.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
AiActivateAbilityAction: add Targets field (was a no-target stub).
ActionCandidateGenerator.ActivateAbilityCandidates (new):
- Iterates all field units incl. ArchSpirit
- Skips exhausted/CanUseAbility=false/disabled/uses-exhausted units
- Checks SP/ST/hand-size costs before emitting candidates
- For auto-resolved abilities (Random/Self/All targets): emits one
null-target candidate — server resolves
- For single client-pick actions: emits one candidate per valid target
in range, respecting TargetType (Unit/ArchSpirit/Spirit) and
TargetOwnership (Enemy/Ally/Any)
- Multi-pick and ChooseOne: emits null, server handles
- Invalid candidates are discarded by the heuristic engine's try/catch
HeuristicDecisionEngine.ApplyAction: added AiActivateAbilityAction case
→ GameEngine.ActivateAbility (so simulation can score ability effects).
AiPlayerSession.ActionToMessage: added AiActivateAbilityAction case
→ game.activate_ability message with targets.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
ScoringFunctions improvements:
- AffinityControlScore: add cluster bonus (+1.5 per tile adjacent to
another matching-affinity tile) so Terramorpha chaining near existing
converted tiles scores higher than isolated placements
- ThreatScore: scale threat penalty with ArchSpirit HP — below 50% HP
adds -40 per threat, below 25% adds -90 (AI retreats/defends when hurt
instead of ignoring danger until death)
- ResourceScore: raise ST token value 5→8 (tokens are immediately fungible)
- SacrificeOpportunityScore (new): one-step lookahead that detects when
sacrificing adjacent units would unlock an unaffordable card in hand;
adds that card's estimated value so the greedy engine connects
sacrifice→gain ST→play card chains rather than seeing sacrifice as a
net loss
AiDifficultyProfiles: halved all timing delays across tiers 1–10
(think time and between-action delay) for faster gameplay during development
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
AiPlayerSession now drives its own execution via RunAsync():
- Sends game.ready, then polls DB state every 1 s
- IsMyTurn(): Placement = AI hasn't placed yet (simultaneous);
Draw/Main = AI is the active player
- On turn detection: fires ExecuteTurnAsync in background,
backs off to 10 s re-check (watchdog against silent failures)
- Interlocked guard prevents concurrent turn execution
- Exits cleanly on Completed/Abandoned session or GameOver phase
AiPlayerSessionManager starts RunAsync instead of SendReadyAsync,
and drops the AiTurnStartedEvent consumer entirely — polling is
resilient to missed events and handles placement without needing
GamePlaceArchSpiritHandler to publish a turn trigger.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
AiPlayerSession.ExecuteTurnAsync was computing the action plan while the
game state was still in Draw phase. ActionCandidateGenerator.All returns
only [AiDrawAction] during Draw, so the plan was always [draw, end_turn] —
the AI never moved, played cards, or attacked.
Fix: when state is Draw phase, invoke game.draw immediately, reload
StateJson from the DB (post-draw Main state), then compute the full plan
with the actual hand contents. ReloadStateAsync opens a fresh scope so it
sees the committed row the draw handler just wrote.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
NatsEventBus.SubscribeAsync uses queueGroup=null, so every pod receives
every NATS event. AddAiService was guarded by IsEnabled("game"), meaning
ALL game pods also started AiPlayerSessionManager. On each AiTurnStartedEvent,
all 3 pods (2 game + 1 AI) would concurrently call ExecuteTurnAsync — causing
draw/action conflicts and the AI appearing to stall or do nothing.
Fix: remove AddHostedService from AddAiService; add it to Program.cs under
IsEnabled("ai") so only the dedicated AI pod (ENABLED_SERVICES=game,ai)
starts the session manager. Game pods still register AiPlayerSessionManager
as a Singleton (for potential injection) but never start its event loop.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
AiPlayerSession.ExecutePlacementAsync — NullReferenceException:
Sent { Coord = ... } but GamePlaceArchSpiritRequest.Position is the
field name. Changed to { Position = ... }.
GameUpdateLobbyRulesHandler — rules locked after adding AI:
GuestReady=true is set when AI joins so the game auto-starts when
host readies, but that flag was also blocking rule edits via
CANNOT_CHANGE_RULES_WHILE_READY. Fix: inject IAiAccountRegistry
(optional) and only block when a HUMAN guest is ready.
CustomLobby.gd — AI indicator not showing / rules reset on refresh:
add_ai: populate ai_slots immediately from the game.ai.add ACK
response so _refresh_display sees the AI before the push arrives.
update_rules + lobby_updated push: keep lobby["rules"] in sync so
_refresh_display() doesn't clobber _current_rules with stale data.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
AiDeckResolver (DbUpdateConcurrencyException on re-add):
- ReplaceRange via EF navigation property was failing when the same AI
account's deck was synced more than once (retry after a failed lobby
attempt left EF's change-tracked xmin stale).
- Fix: use ExecuteDeleteAsync to delete old DeckCard rows directly
(bypasses change tracker), then AddRange new ones without touching
the navigation property. Fully idempotent.
GamePlaceArchSpiritHandler (AI never places ArchSpirit):
- Previous fix checked newState.ActivePlayerAccountId, which stays as P1
throughout the simultaneous placement phase — so AI opponents in seat 1
(guest) were never triggered.
- Fix: when !bothPlaced, scan all players for AI accounts that haven't
placed yet and publish AiTurnStartedEvent for each. When bothPlaced,
keep the existing check for the first active player in Draw/Main phase.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Two bugs prevented AI from participating after being added to a lobby:
1. GameAddAiHandler never set GuestReady=true (or IsReady in additional
players JSON), so the all-ready check in GameLobbyReadyHandler never
fired — the game never started when the host clicked ready.
Fix: set GuestReady=true for 1v1, IsReady=true for multi-player.
2. GamePlaceArchSpiritHandler never published AiTurnStartedEvent.
If the human places first, the AI placement turn was never triggered.
Likewise, if the AI goes first in the Active phase after both players
place, no event fired. Fix: check the new active player after each
placement and publish AiTurnStartedEvent if it is an AI seat.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
AiDeckResolver depends on BazaarDbContext to look up prebuilt decks, but
AddAiService never registered it. When NatsMessageRpcResponder.StartAsync
called GetServices<IMessageHandler>(), DI failed to instantiate
GameAddAiHandler (via AiDeckResolver → BazaarDbContext not found),
causing the entire NATS subscription startup to throw — leaving the AI
pod with no NATS listeners.
Fix: AddBazaarDatabase(configuration) is now called at the top of
AddAiService before any handlers are registered.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
- Phase Summary table: mark phases 1.1-4.4 as done (added 4.3 training
pipeline and 4.4 client UI); mark 5.1-5.6 as TODO with status column
- Section 7.3: replace placeholder model spec with actual implemented
ValueNet MLP (1024->512->256->128->1 tanh, ~920k params, ONNX contract)
- Section 7.4: replace stub pipeline with actual How to Train the AI
guide (self-play -> export -> train_neural.py -> hot-swap); includes
CLI flags table and iterative improvement workflow
- New section: Remaining Work (Phases 5.x) with full implementation
detail for each pending phase: active abilities (5.1), triggered
target selection (5.2), adaptive difficulty API (5.3), personality
& display (5.4), counter-deck selection (5.5), initial model
operational runbook (5.6)
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
- Add NeuralModelRegistry singleton: loads ONNX model from Ai:NeuralModelPath,
hot-swap via ReloadAsync(), static Instance for engine access
- Add NeuralEvaluator: GameState → ONNX inference with heuristic fallback when
no model is loaded (tiers 9-10 fully playable without a trained model)
- Add AiNeuralStartupService: loads model at startup, logs if not configured
- Add NeuralDecisionEngine: MCTS with neural leaf evaluation (400 sims/action,
6-10s budget) replacing random rollouts with direct score estimation
- Set tiers 9-10 EngineType="Neural" in AiDifficultyProfiles
- Add AiModelPage (/ai/model): model status, hot-swap button, ONNX contract docs
- Register NeuralModelRegistry + NeuralDecisionEngine in SOR.Ai and SOR.Admin
- Add Microsoft.ML.OnnxRuntime 1.18.0 to central package versions
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
- AiDeckResolver: resolves which prebuilt deck an AI uses for a given
difficulty. Checks AiDeckAssignment table first (admin-configured),
then falls back to a random active starter deck. Creates/updates a real
Deck row in CollectionDb so GameReadyHandler's standard path works unchanged.
- AiDeckAssignment entity + EF migration (ai_deck_assignments table): admin
maps Difficulty 1-10 → PrebuiltDeckId; null = "random starter".
- GameAddAiHandler: replaced direct Deck lookup with AiDeckResolver.ResolveAsync.
- AiSeedStartupService: removed AiDeckSeeder call — decks are resolved
per-game from prebuilt decks, not pre-seeded with placeholder cards.
- ServiceRegistration: registers AiDeckResolver as Scoped.
- Admin: new /ai/deck-config page (AiDeckConfigPage) showing a D1-D10 table
with prebuilt deck dropdowns; saved via upsert. Added to AI nav section.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
SOR.Admin now references SOR.Ai (Phase 3 calibration pages), which
transitively depends on SOR.Game. Both csproj files must be copied
before dotnet restore or the layer cache miss causes NETSDK1004.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
- MCTS (UCT) decision engine for difficulty tiers 6-8 (MctsNode, MctsSimulator,
MonteCarloEngine); tiers 6-8 updated from Heuristic → MCTS in AiDifficultyProfiles
- AiEloService: separate ELO ledger for AI accounts (ai_elo_records table)
so calibration games don't pollute the human RankScore leaderboard
- FinalizeGameAsync / FinalizeMultiPlayerGameAsync: AI accounts are now guarded
from RankScore and OriginPoints adjustments (IsAi check)
- AiPlayerSessionManager: async GameEnded handler calls AiEloService
- SelfPlayRunner: pure in-process AI vs AI game loop (no DB, no NATS)
- SelfPlayOrchestrator: batch runner loading real decks from DB, parallel games
- FeatureExtractor: GameState → float[1024] feature vector for ML training
- GameReplayExporter: replays completed sessions → TrainingRecord JSONL
- TrainingDataWriter: async JSONL writer
- AiCalibrationJob: pairwise self-play calibration (D1vD2…D9vD10), writes
AiCalibrationRun rows to GameDbContext
- EF migration: ai_elo_records + ai_calibration_runs tables applied to remote DB
- SOR.Admin: references SOR.Ai; new AI section in NavMenu with ELO Leaderboard
and Calibration pages; SelfPlayOrchestrator + AiCalibrationJob registered
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Full design document for the AI player system: project structure,
integration approach (AI as a real player through the existing handler
pipeline), 23 granular implementation phases across 5 tracks (scaffold,
turn pipeline, MCTS, neural engine, polish), difficulty/strategy system,
training data pipeline, and self-play calibration strategy.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
- HasAbilities now uses JsonDocument to check array length > 0, so
cards with an empty [] don't incorrectly show as having abilities.
- Added Card Desc column/filter: whether the card's own Description
field is non-empty.
- Added Ability Desc column/filter: whether at least one ability in the
JSON array has a non-empty description field. Shows — when card has
no abilities.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
- /reports/cards: filterable report of all cards with columns for 3D
model (+ AI badge), 2D art, abilities, SFX, and prebuilt deck membership.
All entries link to card editor and deck detail pages.
- AccountDetail: danger-zone Delete Account section that cascades through
collection, bazaar, chat, game lobbies/presets, and identity data.
Requires typing DELETE to confirm; preserves game session history.
- NavMenu: Reports section wired up.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Both GameLobbyReadyHandler and MatchmakerService were building BoardTemplateSnapshot
without GridType/HexSides. FromTemplate checks HexSides > 0 to set IsTemplateBased,
so hex templates were silently treated as square grids.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
IsOrthogonallyAdjacentTo uses Manhattan distance == 1, which only
covers the 4 square neighbours. The two hex-diagonal offsets (1,-1)
and (-1,+1) have Manhattan distance 2 and were rejected.
Now mirrors the existing server pattern: use HexGrid.Distance == 1
when board.HexSides > 0, fall back to IsOrthogonallyAdjacentTo for
square boards.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
- TileBottomModel gains a Shape column (Square/Hex, default Square)
so admins can manage separate stalagmite pools per tile grid type
- EF migration 20260407153312_AddTileBottomModelShape adds the column
with a default of 'Square' to preserve existing data
- Admin UI splits the Tile Bottom Models section into Square and Hex
cards, each with their own Add/toggle/delete controls
- content.tile_bottoms response now returns squareUrls and hexUrls
separately; handler queries each shape independently
- ContentCache splits into _tile_bottom_urls_square / _hex and
get_random_tile_bottom_url() now takes a shape parameter
- game_screen: hex tiles with no 3D model now receive a hex stalagmite
instead of silently skipping; 3D-model path passes shape_key through
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Main already had the HexLine+flood-fill implementation. Resolution keeps
main's CartToHex/CubeRound local functions and zone logic, but switches
the sideLength source from _pendingHexRadius to _pendingHexSideLength and
adds _template.HexSideLength = L to persist the new field.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add HexSideLength property to BoardTemplate (tiles per edge)
- Add EF migration 20260406000000_AddBoardTemplateHexSideLength
- Replace NPolyInside (Euclidean circle test) with HexLine + flood-fill:
* N corners placed at circumradius = (L-1)/(2·sin(π/N)) in hex-Cartesian
* Corners snapped to nearest integer axial cell via HexRound
* Perimeter built by hex-line lerp between adjacent corners
* Interior determined by BFS flood-fill from center
- Auto-compute bounding hex radius from side length (max(L*2, ceil(circumR)+2))
- UI: expose Side Length input instead of Radius; canvas header shows L=n tiles/edge
- Zone tiles now walk along actual hex-line edges from each corner
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>