The planner worked one unit at a time, picking each one's best destination
independently. That is why nothing was ever taken: a defended province is
attacked by a single unit, bounces, and is attacked again next year for ever.
It now works the other way round -- list what is worth having, work out how
many units it takes, and commit that many or none. A province you cannot take
is not worth one unit.
Three things came out of that. A single unit still walks at an *empty*
province, since the worst case is a bounce and it might be free, but never at
a garrison. Garrisoning now needs two neighbours rather than one, because one
unit cannot dislodge another -- with one counting as a threat, almost every
centre on a crowded board was threatened, almost every unit stood still, and
nothing happened for two centuries. And an attack is priced at two units
unless the defender has two friends near enough to prop it up; assuming one
was enough meant almost every attack was priced at three, which nobody can
afford.
Asking for help now works from what a power wanted and could not have. It
used to read the moves already planned, which was exactly backwards once the
planner learned not to attack what it cannot take: the target is no longer in
the plan, so the bot stopped asking precisely when it needed to.
The game is now called at the end of 1912. This game has no clock of its own
and seven cautious powers will hold a standoff for ever -- a run to 2198 had
the board still alive and nobody near eighteen. Eighteen wins outright and
otherwise the survivors draw, which is a proper ending here and the commonest
way real games finish.
Units are a soldier and a ship rather than two wedges. A helmet and square
shoulders read as troops at any size; a triangle above a curved hull is a
boat before anybody has decided to look. Both in the power's colour with one
flat highlight, and a shadow so they sit on the ground instead of floating
over a border.
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.
Clicks on the board, because that is where the question is. Select a unit,
pick a verb, and the provinces the next click will accept light up. Nobody
writes a move the rules were never going to allow, and nobody has to learn a
notation to find that out.
What is offered comes from the rules rather than from the map, which is the
same split the map is built on: a fleet on the north coast of Spain is drawn
identically to one on the south coast and can go to entirely different
places. A support is only offered where both units could have gone, since you
cannot support a move you could not have made yourself, and a fleet is only
asked which coast it means when more than one is reachable.
Orders are drawn where they are given -- an arrow to the destination, a
dashed line to what a support is holding up, a ring round a unit staying put
-- and written out beside the board in the rules' own words, because an arrow
cannot tell you that the support you meant for Vienna is going to Budapest.
The written list runs through the validator on every keystroke, so an order
the rules will not take is struck through while it is being written rather
than after the turn.
Three attempts at drawing this map came to nothing worth looking at. Dividing
the plane by nearest province gives a tidy board that looks nothing like
Europe. Drawing the adjacency graph gives something unimpeachable about the
rules and not a map at all -- circles joined by lines. Fifty-six polygons
placed by eye gives fifty-six islands.
The standard map published with the diplomacy engine is AGPL-3.0, the same
licence as this project, so it can be carried across whole with attribution
rather than approximated badly. tools/map.py extracts the outlines, the unit
coordinates and the layer transform into board.json and can be re-run against
a newer copy. NOTICE.md says where it came from and what is still ours, which
is every colour and every mark drawn on top.
Drawing Europe accurately is real work, somebody did it properly, and they
published it under a licence that invites exactly this. Three days of my
approximating it would have produced something worse than the thing that
already existed.
Clicking still answers with the rules rather than the picture: a shape cannot
say that a fleet on Spain's north coast may not enter the Gulf of Lyon while
one on the south coast may, because both coasts are the same shape.
The board is regions again. Voronoi cells divide it with no gaps and no
overlaps and look like a board, which is what this was always supposed to be.
What they cannot do is reproduce every adjacency in the rules, because
provinces interleave -- the Adriatic borders Venice with Trieste between
their centres. The lesson I drew from that was to abandon regions and draw
the adjacency graph, which is unimpeachable and is not a map. It is circles
joined by lines.
The right answer is to stop asking the picture to carry the rules. Clicking a
province lights up exactly where its unit may legally go, taken from the
graph rather than from which shapes happen to share an edge. Vienna lights
Bohemia, Galicia, Budapest, Trieste and Tyrolia; a fleet on the north coast
of Spain does not light the Gulf of Lyon. The picture is a picture and the
rules answer for themselves when asked.
Coordinates placed by hand, roughly where each province falls in Europe, and
everything else drawn from those and from the adjacency rules. Nothing here
is a picture of anybody's board.
It draws the graph rather than regions, and that was not the first idea. The
first idea was Voronoi cells -- every point belonging to the nearest province
-- which makes a handsome cut-paper board and is wrong. Sixty-five pairs that
border each other in the rules came out with regions that did not touch, and
no amount of moving coordinates fixes it: provinces here interleave. The
Adriatic borders Venice with Trieste between their centres; the Atlantic
borders North Africa around the outside of Spain. Convex cells cannot say
that. A map that shows two regions meeting when the rules say otherwise is
worse than an ugly map -- it is a map that loses you the game.
The tests found three provinces drawn on top of each other and a distance
check of mine that was measuring Europe rather than checking my typing: it
failed fifteen honest placings because oceans are large and Moscow borders
five things. The exact check is that a line exists for every border in the
rules and for no others.
The viewBox is fitted to what is actually drawn. Europe is not rectangular,
and the box the coordinates were typed into left a third of the frame as
empty ocean -- which wastes the one thing this game was given more of than
the others.
A bot that only answers is not negotiating, it is a form to fill in. propose()
works from the plan the power has already made: what it wants this turn, where
that will not work alone, and who could make it work. Help taking something
defended first, then a quiet border over ground neither of them owns, then
peace when a neighbour is over your centres and your ambitions are elsewhere.
Three a turn at most, or six powers talking at once is a mailstorm.
Each overture carries what the power says, so it reaches a human as a message
rather than as a form.
A power will offer a quiet border to somebody it is attacking somewhere else,
and that is on purpose. Marching on French Belgium while suggesting both
sides leave Burgundy alone is not a lie and not incoherent -- a promise about
Burgundy is a promise about Burgundy, and it will be kept to the letter by
somebody robbing you at the same moment. A test asserted the opposite and the
test was wrong: refusing that offer would be playing a politer game than this
one. Asking the power you are attacking to help you, or offering it peace
while your orders say otherwise, are different things and are both refused.
Nothing here promises any of it will be kept. Whether the power still wants
the deal when orders are due is settled in settleUp, and the answer is
sometimes no.
A position is worth its centres, and almost nothing else: units are how you
get them and are worth nothing in themselves. Every other term is a small
correction on that one fact.
Orders are a greedy plan taken in order of what is worth most, with a second
unit put behind the first when the prize is worth two units -- a bot that
never doubles up is not playing this game. Agreements are applied after the
plan rather than as a constraint on it, on purpose: the plan has to know what
it is giving up before it can decide whether the promise is worth keeping.
Three things the tests taught it. It garrisons a threatened centre it is
already standing on, because scoring only moves had it defending Berlin by
marching the Munich garrison there. It never shoves at its own countryman,
which has no strength and wastes two units. And the price of breaking a
promise is how far it trusts the partner, not how far the partner trusts it
-- the other way round gives a power that has been lied to four times a high
cost of retaliating, because it has been scrupulous and is still well thought
of, which is exactly backwards.
Every decision comes back as a sentence. When a power turns on you it says
what the province was worth and what it thought you were worth, because being
betrayed should be infuriating rather than mysterious.
All 176 published cases now parse and run. Retreating passes 18 of 18,
building 7 of 7, civil disorder 13 of 13; movement is unchanged at 133 of
139.
The retreat and winter engine code was written before these cases and mostly
held up, but civil disorder was wrong in a way playing would never have shown.
It measured distance to a power's *home* centres. The rule is distance to the
centres it owns -- a Russia driven out of Moscow and holding Sweden measures
from Sweden -- so every power that had lost a home centre was disbanding the
wrong unit.
And it measured over the graph each unit moves on, which is wrong in both
directions. An army counts sea provinces it would have to be convoyed across,
so Albania is two steps from Naples rather than unreachable. A fleet counts
inland provinces it could never enter, so the Baltic is two from Warsaw. That
reads as nonsense until you notice what is being measured: not how the unit
would get home, but how far out of the way it is. A fleet in the Baltic is
still in the middle of Russia's business; one in the North Atlantic is not.
Civil disorder also only applies to the shortfall. A power that disbanded one
of the two it owed has half answered, and the automatic rule picks from what
is left rather than from what it started with.
A known deviation nobody has written down is a bug waiting to be
rediscovered, and a red mark nobody can explain is worse than a red mark with
a reason next to it.
A game of this ends in a solo, an elimination, a draw, or somebody else's
solo, and none of those is a win or a loss in the shape the other games on
this site use. The draw is the one that matters: it is the usual outcome and
it is neither, so it cannot borrow either tune.
Convoy routing is breadth-first over the fleets actually ordered to convoy
this army, so it returns the shortest chain and answers null rather than
guessing. It takes a set of fleets to treat as already gone, which is what
the adjudicator will need to ask whether a convoy survives being attacked.
The tests found a wrong assumption of mine rather than a wrong line of code:
taking the Channel out of a London to Brest convoy leaves no route at all.
The North Sea does not touch the Mid-Atlantic on this board -- the long way
round is over the top through the Norwegian Sea -- so the Channel is the
whole western sea route.
Seventy-five provinces as two graphs, because an army and a fleet do not move
on the same one, and three provinces whose two coasts do not connect.
The topology is a fact about a published game and free to use; the artwork is
not, and there is none here -- the map will be generated from this data the
way the cave game's dodecahedron is. The name is a working one for the same
reason the starship game is not called what you expect.
The tests check the board against itself, and symmetry is the one that pays:
it found the Skagerrak wired to the Baltic, which would have opened a back
door into the Baltic and made Denmark worth nothing.