each player, the nodes occupied in the starting posi-
tion are selected as the first ply of the graph search, as
shown in figure 4. These starting positions also satisfy
the goal condition for occupying three supply centers
(four for Russia), meaning the algorithms have to find
the shortest path(s) through the graph, starting with
the first ply of the search in the player’s home na-
tion to pass through or occupy an additional 13 supply
centers (12 for Russia).
Figure 4: An example of the first ply of the Diplomacy
gameboard search for the German player.
In figure 4, the root of the search tree is the na-
tion for that player (Germany in the example). The
first level of the search tree are the nodes correspond-
ing to the starting positions for that player. (In the
case of Germany, there are armies in Berlin and Mu-
nich and a fleet in Kiel.) Note that the nodes for
the starting positions are colored green. That is be-
cause these nodes are supply centers that are occu-
pied by the player at the beginning of the game. The
next layer shows the expansion of the graph nodes
for provinces connected to the starting provinces in
the Diplomacy graph. Red nodes are provinces that
can’t be occupied by that type of unit. For exam-
ple, the unit in Berlin can not enter the Baltic Sea
node because it is an army and only fleets can oc-
cupy sea provinces. Gray nodes are nodes that are
in the visited list because they have already been tra-
versed. (The gray nodes in the figure correspond to
the starting nodes.) Finally, nodes with bold text are
supply centers (goal states). The criteria for selecting
the search algorithms were that the search algorithm
be usable on a highly connected graph, like the Diplo-
macy map graph, and that they use varying degrees of
heuristics. One search was selected that doesn’t uti-
lize heuristic values at all (breadth first search), one
was selected that only utilizes heuristic values (greedy
best first search), and one was selected that utilizes
both heuristic values and the actual cost of the path
found so far (A* search). The details of these algo-
rithms can be found in (Russell and Norvig, 2003).
Brief descriptions of the algorithms and the heuristics
applied are provided in the sections that follow.
3.1 Breadth First Search
Breadth first search was chosen as the non-heuristic
search algorithm. In the example shown in figure 4,
the algorithm will start by inserting the three start-
ing provinces (Berlin, Kiel, and Munich) into a first-
in/first-out (FIFO) queue. The goal count is also set
to three, since the three starting positions are sup-
ply centers (goal nodes). Since they are goal nodes,
when they are added to the queue, these provinces are
added to the visited list to prevent cycles. Then, the
provinces will be extracted from the queue in alpha-
betical order (since that is the order they were inserted
in) and the provinces connected to them that are legal
moves for the type of unit occupying the province and
are not already in the visited list will be added to end
of the queue. To take the province of Berlin as an ex-
ample, the Baltic Sea will not be added to the queue
because it would not be a legal move for the army in
Berlin and Kiel and Munich will not be added to the
queue because they are already in the visited list. This
means Prussia and Silesia will be added to the queue
and then Kiel will be removed from the queue for ex-
pansion. This continues until the supply center count
reaches 16, at which time the search is terminated.
3.2 Greedy Best First Search
Greedy best first search was selected as an exam-
ple of a heuristic-only search algorithm. Greedy best
first search proceeds as described in the breadth first
search, except that each node has an associated f-
value where f (x) = h(x). The heuristic value (h(x))
is set to five initially, for all players except Russia.
Because Russia starts with four units instead of three,
the initial heuristic value is set to four. These heuris-
tic values reflect a theoretical minimum value for the
distance to the number of nodes that unit needs to con-
tribute to the overall goal of 16 supply centers. When
a goal node is entered into the queue, the heuristic
value for it is decremented by one, so in the case of
Germany as illustrated in figure 4, the initial heuris-
tic will be h(x) = 5. When Berlin, Kiel, and Munich
are added to the queue, the heuristic value associated
with each of these provinces will be decremented to
h(x) = 4. The queue is a priority queue, so lower f-
values will be extracted from the queue first in FIFO
order. In this case, there will be no difference in
the extraction order from the queue; however, when
Denmark and Holland are added to the queue, their
heuristic values will be h(x) = 3 because they are goal
nodes, so they will be extracted from the queue before
the remaining provinces on the same level of the tree
– and their children will also have h(x) = 3, unless the
child is also a supply center, in which case it will have
a value of h(x) = 2. The search essentially becomes a
depth first search on these nodes at this point.
A COMPARISON OF DIPLOMACY GAMEBOARD GRAPH SEARCH ALGORITHMS
373