Skip to content

The Ruby Adjudicator File Format

Nameless edited this page Nov 12, 2013 · 38 revisions

Like every badass project, the Ruby Adjudicator has its own file format. Stuff needs to be stored, and we need a format to store them in.

Stuff that needs to be stored, yo

Well, we are a Ruby Adjudicator, so naturally, we need to store two things: Diplomacy game state (ie. area ownerships and unit placement), and Diplomacy orders (ie. where we have the illusion that our units will go next). Everything will be stored in a custom text format, because why not, right?*

Important course in the appropriate lingo

In this here game, we have a map, divided into areas, some of which are also supply centers ( SCs ). Some areas are in land, some are out in the sea.

In each area, there can be one (and only one) unit at a time. Units (and areas) belong to a power. Sometimes, just to separate the plebeians from the patricians (gratuitous Ancient Rome reference for absolutely no reason), we will refer to the nationality of a unit, while areas might have an owner (both refer to the power who controls the thing in question). Expect to be mocked if you don't use the lingo, you have been warned.

Diplomacy game state

State is expressed with a space-delimited list of power states:

<one-power's-state> <another-power's-state> <as-you-might-guess,-a-third-power's-state>

A power state consists of the name of the power, followed by a comma-delimited list of units, followed by a comma-delimited list of areas owned, delimited by a colon and a pipe, respectively:

<power-name>:<unit>,<aaand-unit>|<area-abbr>,<oh-lord-another-area-abbr>,<etc>,<etc>,<enough.>
  • A unit consists of a type shorthand (A for army, F for fleet), followed immediately by an area abbreviation, and optionally by a dislodgement
  • An area abbreviation consists of single area abbreviation (science)
  • A dislodgement consists of an asterisk (*) followed by an area abbreviation (denoting where the move that dislodged this unit originated from)

Any and all who do not observe the aforementioned rules will be scoffed and ignored by our parser. They are free to write their own.

Some full examples, for you visual learners

France's starting position

France:APar,FBre,AMar|Par,Bre,Mar,Gas,Pic,Bur

I'm sorry Austria, you are fucked

Italy:ATyr,AVen,FIon|Ven,Apu,Tus,Pie,Rom,Nap Austria:FAlb,ASer,ABud|Bud,Boh,Gal,Vie,Tri,Tyr

Notice how even though Italy has a unit in Tyrolia, it still belongs to Austria. Notice also how sea areas (Ion) are never controlled by anyone. This is not enforced by the parser, but circumventing it is FROWNED UPON. You have been warned twice, now. Watch it.

Russia has no units

Russia:|War,Mos,Sev

England dislodged France in Belgium

England:ABel,FNth,FEng|Bel France:ABel*Lon

England's dislodging move came from London.

Diplomacy orders

Orders come in seven different flavours, each with their own format.

Moves

<Unit type><Unit area abbrv>-<Destination area abbrv>

Examples

ASwe-Nor
FSpa(sc)-Mar
ALon-Bel

Supports

<Unit type><Unit area abbrv>S<Supported unit type><Source area abbrv>-<Destination area abbrv>

Examples

FSkaSASwe-Nor
APorSFMAO-Spa(sc)
FHolSALon-Bel

Holds

<Unit type><Unit area abbrv>H

Examples

FDenH
ANAfH
FConH

Support Holds

<Unit type><Unit area abbrv>S<Supported unit type><Supported area abbrv>H

Examples

AKieSFDenH
FTunSANAfH
FGreSFConH

Convoy

<Unit type><Unit area abbrv>C<Convoyed unit type><Source area abbrv>-<Destination area abbrv>

Examples

FEngCALon-Bel
FMAOCASyr-StP

Builds/disbands

<Unit type><Unit area abbrv>(B|D)

Examples

ABudB
FTriB
ANAfD

Retreats

<Unit type><Unit area abbrv>*<Destination area abbrv>

Examples

ASwe*Nor
FSpa(sc)*Mar
ALon*Bel

* Also because this was mainly developed to write Cucumber tests, and it was convenient for that.