Assignment 2
The Data
— introduction
— the rules
— [the data]
— faq
— the view
— the hunt
—
courtesy Richard Buckland, John Shepherd, and many tutors
Introduction
The major modules in The Fury of Dracula need to communicate, and do so in a controlled way. Since they do not share access to a single memory space, data can’t be passed by sharing in-memory data structures. This page describes how data is transmitted between modules.
The data that needs to be communicated includes:
- Information about the game history, which the game engine passes to the AIs
- Moves and messages, which the AIs pass back to the game engine
The game engine passes the game history to the View ADTs which process it, build a game state, and then make parts of the game state available to the AIs (i.e. give a “view” of the game to the AI).
Here’s what that all looks like.
Moves (and Messages)
Moves are communicated from an AI to the game engine via the function:
void registerBestPlay(char *play, Message message);
The first argument to the function is the player’s move. Each player move is described by a two-character string, which gives the abbreviation of a location on the map (or a special move if Dracula is making a move). The abbreviations are given in a table below. That is all there is to each move: two characters.
Examples: LO
= move to London, CD
= move to Castle Dracula, NS
= move to the North Sea (presumably en route to somewhere else), etc.
The second parameter to the function is a character string of length up to 99 characters containing an arbitrary text message. This information can be made available to other players, but since it is plain text, may be difficult to make use of in any meaningful way.
Past Plays
The Hunter AIs use the HunterView
ADT to collect information about the game state in order to decide on a move. The Dracula AIs use the DraculaView
ADT to collect information about the game state in order to decide on a move. In fact, HunterView
and DraculaView
are both instances of a more general GameView
ADT that manages access to game information. A GameView
contains a representation of the current state of the game and provides an interface for interrogating the game state in a controlled way.
The AIs set up a game state by (ultimately) invoking the function:
GameView GvNew(char *pastPlays, Message messages[]);
This function takes two arguments:
pastPlays
is a string containing a history of moves and actions so farmessages[]
is an array of message strings, one for each move
The most important parameter is pastPlays
, which is a string representing everything that the players have observed happening in the game so far. It lists all the plays made in the game so far by all players (including Dracula) from the earliest turn (at the start of the string) to most recent turn (at the end of the string). The AIs pass the string to the GameView
and then use the appropriate View
interface (either HunterView
or DraculaView
) to find out about it. Note that the pastPlays
strings given to the hunters contain slightly less information than the pastPlays
string given to Dracula.
Each play is 7 characters long (described below) and separated from any following play by a space, and represents what happened during one turn of the game. Each play begins with a single character representing the player whose turn it was:
'G'
= Lord Godalming'S'
= Dr. Seward'H'
= Van Helsing'M'
= Mina Harker'D'
= Dracula
For each hunter play (starting with G, S, H, or M), the player character is immediately followed by 6 characters:
- 2 uppercase characters representing the new location of the hunter (see below for location codes)
- 4 letters representing, in order, the encounters that occurred:
- one
'T'
for each Trap encountered (and disarmed) 'V'
if an immature Vampire was encountered (and vanquished)'D'
if, finally, Dracula was confronted, then'.'
for the remaining 0..4 characters
- one
For each Dracula play (starting with D), the player character is immediately followed by 6 characters:
- 2 uppercase characters representing Dracula's move, which may be any valid location code (see below) if Dracula made a LOCATION move that was revealed, or may be:
'C?'
= City move (unknown city)'S?'
= Sea move (unknown sea)'HI'
= Hide move, if we have discovered it was a hide move'Dn'
= Double Back move: D followed by a single character number (n) from 1-5 specifying the position in his trail to which Dracula is doubling back (e.g., 1 means staying in his most recent location, 5 means returning to his location 5 moves ago)'TP'
= Teleport to Castle Dracula
- 2 characters representing the encounter Dracula placed:
'T'
if a trap was placed, otherwise'.'
'V'
if an immature vampire was placed, otherwise'.'
- 1 character representing the action phase of Dracula’s turn:
'M'
if a trap has left the trail (malfunctions due to old age), and vanishes without a trace. (yay!)'V'
if a vampire has matured. (eek!)'.'
if nothing has occurred (e.g. early in game)
- a single ‘.’ character
The pastPlays
string given to Dracula never contains C?
or S?
, since Dracula always knows exactly where he’s been. It will always contain exact locations for all players (including Dracula).
Sample pastPlays
strings
After the first 5 turns (i.e. at the end of Round 0):
GBE.... SBR.... HLO.... MCA.... DC?.V..
Godalming moved to Belgrade, Seward is in Brussels, van Helsing is in London, and Mina Harker is in Cadiz. Dracula has planted an immature vampire in whatever location he currently resides.
Same game, after the 6th turn (i.e., after the first turn of Round 1):
GBE.... SBR.... HLO.... MCA.... DSJ.V..
GSJVD..
Godalming has stumbled onto Dracula’s location in Sarajevo, where he has vanquished the immature vampire, and encountered Dracula.
Below are more examples, based on real games from 15s2. Note that pastPlays
strings can contain hundreds of moves. Also note that the pastPlays
strings below contain newlines. This is for display purposes only; moves are always separated by a single space character in real pastPlays
strings.
Samples from Game #0:
The pastPlays
string at end of round 0,
start of round 1, given to Godalming:
GMN.... SPL.... HAM.... MPA.... DC?.V..
The pastPlays
string then given to Seward:
GMN.... SPL.... HAM.... MPA.... DC?.V..
GLV....
The pastPlays
string then given to Van Helsing:
GMN.... SPL.... HAM.... MPA.... DC?.V..
GLV.... SLO....
The pastPlays
string then given to Mina Harker:
GMN.... SPL.... HAM.... MPA.... DC?.V..
GLV.... SLO.... HNS....
The pastPlays
string then given to Dracula:
GMN.... SPL.... HAM.... MPA.... DZU.V..
GLV.... SLO.... HNS.... MST....
The pastPlays
string given to Godalming at the start of round 2:
GMN.... SPL.... HAM.... MPA.... DC?.V..
GLV.... SLO.... HNS.... MST.... DC?T...
The pastPlays
string then given to Seward:
GMN.... SPL.... HAM.... MPA.... DC?.V..
GLV.... SLO.... HNS.... MST.... DC?T...
GIR....
Samples from Game #1:
The pastPlays
string given to Mina Harker after several rounds:
GMN.... SPL.... HAM.... MPA.... DC?.V..
GLV.... SLO.... HNS.... MST.... DC?T...
GIR.... SPL.... HAO.... MZU.... DCDT...
GSW.... SLO.... HNS.... MFR.... DC?T...
GLV.... SPL.... HAO.... MZU.... DC?T...
GSW.... SLO.... HNS....
The pastPlays
string given to Dracula after Mina’s move:
GMN.... SPL.... HAM.... MPA.... DGA.V..
GLV.... SLO.... HNS.... MST.... DHIT...
GIR.... SPL.... HAO.... MZU.... DCDT...
GSW.... SLO.... HNS.... MFR.... DKLT...
GLV.... SPL.... HAO.... MZU.... DBCT...
GSW.... SLO.... HNS.... MMR....
Samples from Game #2:
The pastPlays
string given to Godalming after several rounds:
GED.... SGE.... HZU.... MCA.... DCF.V..
GMN.... SCFVD.. HGE.... MLS.... DC?T...
GLO.... SMR.... HCF.... MMA.... DC?T...
GPL.... SMS.... HMR.... MGR.... DBAT...
GLO.... SBATD.. HMS.... MMA.... DC?T...
GPL.... SSJ.... HBA.... MGR.... DC?T...
GPL.... SSJ.... HBA.... MGR.... DC?T...
The pastPlays
string given to Dracula after all other hunters have
moved:
GED.... SGE.... HZU.... MCA.... DCF.V..
GMN.... SCFVD.. HGE.... MLS.... DBOT...
GLO.... SMR.... HCF.... MMA.... DTOT...
GPL.... SMS.... HMR.... MGR.... DBAT...
GLO.... SBATD.. HMS.... MMA.... DSRT...
GPL.... SSJ.... HBA.... MGR.... DALT...
GPL.... SSJ.... HBA.... MGR.... DMAT...
GLO.... SBE.... HMS.... MMATD..
Table of Locations
Location Name | Abbrev | Location ID | Type |
---|---|---|---|
Adriatic Sea | AS | ADRIATIC_SEA | SEA |
Alicante | AL | ALICANTE | LAND |
Amsterdam | AM | AMSTERDAM | LAND |
Athens | AT | ATHENS | LAND |
Atlantic Ocean | AO | ATLANTIC_OCEAN | SEA |
Barcelona | BA | BARCELONA | LAND |
Bari | BI | BARI | LAND |
Bay of Biscay | BB | BAY_OF_BISCAY | SEA |
Belgrade | BE | BELGRADE | LAND |
Berlin | BR | BERLIN | LAND |
Black Sea | BS | BLACK_SEA | SEA |
Bordeaux | BO | BORDEAUX | LAND |
Brussels | BU | BRUSSELS | LAND |
Bucharest | BC | BUCHAREST | LAND |
Budapest | BD | BUDAPEST | LAND |
Cadiz | CA | CADIZ | LAND |
Cagliari | CG | CAGLIARI | LAND |
Castle Dracula | CD | CASTLE_DRACULA | LAND |
Clermont-Ferrand | CF | CLERMONT_FERRAND | LAND |
Cologne | CO | COLOGNE | LAND |
Constanta | CN | CONSTANTA | LAND |
Dublin | DU | DUBLIN | LAND |
Edinburgh | ED | EDINBURGH | LAND |
English Channel | EC | ENGLISH_CHANNEL | SEA |
Florence | FL | FLORENCE | LAND |
Frankfurt | FR | FRANKFURT | LAND |
Galatz | GA | GALATZ | LAND |
Galway | GW | GALWAY | LAND |
Geneva | GE | GENEVA | LAND |
Genoa | GO | GENOA | LAND |
Granada | GR | GRANADA | LAND |
Hamburg | HA | HAMBURG | LAND |
Ionian Sea | IO | IONIAN_SEA | SEA |
Irish Sea | IR | IRISH_SEA | SEA |
Klausenburg | KL | KLAUSENBURG | LAND |
Leipzig | LI | LEIPZIG | LAND |
Le Havre | LE | LE_HAVRE | LAND |
Lisbon | LS | LISBON | LAND |
Liverpool | LV | LIVERPOOL | LAND |
London | LO | LONDON | LAND |
Madrid | MA | MADRID | LAND |
Manchester | MN | MANCHESTER | LAND |
Marseilles | MR | MARSEILLES | LAND |
Mediterranean Sea | MS | MEDITERRANEAN_SEA | SEA |
Milan | MI | MILAN | LAND |
Munich | MU | MUNICH | LAND |
Nantes | NA | NANTES | LAND |
Naples | NP | NAPLES | LAND |
North Sea | NS | NORTH_SEA | SEA |
Nuremburg | NU | NUREMBURG | LAND |
Paris | PA | PARIS | LAND |
Plymouth | PL | PLYMOUTH | LAND |
Prague | PR | PRAGUE | LAND |
Rome | RO | ROME | LAND |
Salonica | SA | SALONICA | LAND |
Santander | SN | SANTANDER | LAND |
Saragossa | SR | SARAGOSSA | LAND |
Sarajevo | SJ | SARAJEVO | LAND |
Sofia | SO | SOFIA | LAND |
St Joseph and St Marys | JM | ST_JOSEPH_AND_ST_MARYS | LAND |
Strasbourg | ST | STRASBOURG | LAND |
Swansea | SW | SWANSEA | LAND |
Szeged | SZ | SZEGED | LAND |
Toulouse | TO | TOULOUSE | LAND |
Tyrrhenian Sea | TS | TYRRHENIAN_SEA | SEA |
Valona | VA | VALONA | LAND |
Varna | VR | VARNA | LAND |
Venice | VE | VENICE | LAND |
Vienna | VI | VIENNA | LAND |
Zagreb | ZA | ZAGREB | LAND |
Zurich | ZU | ZURICH | LAND |