The turn loop, and two bugs it found
Spring orders, retreats, autumn orders, retreats, then the winter -- the only phase that changes who owns anything. Everybody talks before the orders: computer powers approach each other, answer on the merits, and what they agree binds that turn and is judged at the end of it on the orders that were given rather than on how the turn came out. The loop has no interface attached on purpose. A whole game can be played out in a test, which is the only way to ask the question that matters about the bots -- not whether an order looks sensible but whether seven powers left alone get anywhere. Asking it found two things nothing else would have. Every bot was submitting orders for all twenty-two units on the board rather than its own three. The validator fills in a hold for every unit, which is right for adjudication and wrong as an answer to what one power does this turn; it only showed up when seven powers were asked at once. And fifteen of nineteen units held in Spring 1901, when in this game every unit moves. An empty province was priced by asking what the unit standing in it could reach -- and there is no unit standing in it -- so every empty non-centre scored zero and every move to one was skipped as worthless. It is sixteen of nineteen now. What the loop still does not do is finish. Played to 2149 the board is alive and nobody has soloed: the powers take the neutrals and then hold each other off. Taking a defended centre needs two units on it and the bots do not reliably arrange that. That is the next piece of work and the test says so rather than pretending otherwise.
This commit is contained in:
+14
-1
@@ -129,8 +129,21 @@ export function chooseOrders(pos: Position, mind: Mind, turn: number): Choice {
|
||||
}
|
||||
|
||||
const broke = settleUp(pos, mind, turn, orders, reasoning)
|
||||
|
||||
/*
|
||||
* Only this power's orders come back. The validator fills in a hold for
|
||||
* every unit on the board -- which is right for adjudication and wrong as
|
||||
* an answer to "what does Germany do this turn", since it hands back orders
|
||||
* for all twenty-two units including everybody else's. Nothing caught that
|
||||
* until seven powers were asked at once and England submitted orders for
|
||||
* the whole board.
|
||||
*/
|
||||
const plan = validate(pos.board, [...orders.values()])
|
||||
return { orders: [...plan.orders.values()], broke, reasoning }
|
||||
const ours = [...plan.orders.entries()]
|
||||
.filter(([at]) => pos.board.get(at)?.power === mind.power)
|
||||
.map(([, order]) => order)
|
||||
|
||||
return { orders: ours, broke, reasoning }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user