Seafarers: rules tests and engine self-play, AI heads for new islands

This commit is contained in:
Claude
2026-10-24 17:15:16 +00:00
parent b5b4afa731
commit 5d36b7bd62
2 changed files with 331 additions and 0 deletions
@@ -130,6 +130,12 @@ class CatanAi : GameAi<CatanState, CatanMove> {
spotValue(state, it.vertex)
}?.let { return it }
// Seafarers: a ship toward an island nobody has landed on is worth more than a card.
legal.filterIsInstance<BuildShip>()
.filter { shipValue(state, seat, it.edge) > 0.5 }
.maxByOrNull { shipValue(state, seat, it.edge) }
?.let { return it }
// A knight is worth playing whenever one is playable: it blocks an
// opponent's best hex and marches toward Largest Army.
legal.filterIsInstance<PlayKnight>().firstOrNull()?.let { return it }