Skip to content

Diplomacy Map Parser Bug when finding Nearest Supply Centers #70

@GDeane

Description

@GDeane

I was making use of this repository for a research project I am working on. I found the following bug in the game graph parsing:

I ran this game using

python lm_game.py --max_year 1904 --num_negotiation_rounds 5 --run_dir results/my_test_run_4

Model used for all powers: gemini-2.5-flash

Attached is a screenshot of the game and phase where I noticed the bug, along with the text file showing phase data given to TURKEY:

Image

TURKEY game graph bug.txt

Bug: "Nearest supply centers" omits directly adjacent SCs

Summary

The territory info block's "Nearest supply centers (not controlled by us)" section skips supply centers that are immediately adjacent to the unit, only listing SCs that are 2+ moves away. This (likely) causes the LLM to undervalue its most accessible offensive targets.

Reproduction

Phase F1904M, playing as Turkey.

Example 1: Territory ARM

The ARM block lists the adjacent territory SEV and correctly labels it:

SEV (COAST) SC Control: Russia  Units: A SEV (Russia)

But the nearest SC section skips SEV entirely:

# Nearest supply centers (not controlled by us):
  MOS (Controlled by Russia), path [ARM→SEV→MOS]
  RUM (Controlled by Russia), path [ARM→SEV→RUM]
  BUD (Controlled by Russia), path [ARM→SEV→RUM→BUD]

Expected: SEV should appear first as a 1-move target, since it is a Russian-controlled SC directly adjacent to ARM.

Example 2: Territory BLA

Same issue. RUM is listed as an adjacent territory with no unit on it:

RUM (COAST) SC Control: Russia

But the nearest SC section skips RUM (as well as BUL):

# Nearest supply centers (not controlled by us):
  GRE (Controlled by Italy), path [BLA→BUL→GRE]
  NAP (Controlled by Italy), path [BLA→BUL→AEG→ION→NAP]
  TRI (Controlled by Austria), path [BLA→BUL→GRE→ALB→TRI]

Expected: RUM (and BUL) should both appear first as 1-move targets.

Impact

This is a meaningful gap for LLM decision-making. In the ARM case, A ARM can move directly to SEV with F BLA support — an immediately actionable capture. By listing MOS (2 moves away) as the nearest target instead, the prompt significantly understates Turkey's offensive potential and may cause the model to overlook viable aggressive moves.

Likely Cause

The pathfinding or SC-listing logic get_nearest_uncontrolled_scs(...) has the following docstring, indicating this was done intentionally. I believe this is a bug that hurts the LLMs ability to make effective decisions:

"""
Return up to N nearest supply centres not controlled by `power_name`,
excluding centres that are the unit’s own province (distance 0) or
adjacent in one move (distance 1).

Each tuple is (sc_code + ctrl_tag, distance, path_of_short_codes).
"""

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions