diplomacy-0.1.0.0: The board game Diplomacy, spoken in Haskell

Copyright(c) Alexander Vieth, 2015
LicenseBSD3
Maintaineraovieth@gmail.com
Stabilityexperimental
Portabilitynon-portable (GHC only)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Diplomacy.Province

Description

 

Synopsis

Documentation

data Province Source

Enumeration of the places on the diplomacy board.

Instances

Bounded Province 
Enum Province 
Eq Province 
Ord Province 
Show Province 
Typeable Province WesternMediterranean 
Typeable Province TyrrhenianSea 
Typeable Province Skagerrak 
Typeable Province NorwegianSea 
Typeable Province NorthSea 
Typeable Province NorthAtlanticOcean 
Typeable Province MidAtlanticOcean 
Typeable Province IrishSea 
Typeable Province IonianSea 
Typeable Province HeligolandBight 
Typeable Province GulfOfLyon 
Typeable Province GulfOfBothnia 
Typeable Province EnglishChannel 
Typeable Province EasternMediterranean 
Typeable Province BlackSea 
Typeable Province BarentsSea 
Typeable Province BalticSea 
Typeable Province AegeanSea 
Typeable Province AdriaticSea 
Typeable Province Denmark 
Typeable Province Tunis 
Typeable Province Sweden 
Typeable Province Spain 
Typeable Province Serbia 
Typeable Province Rumania 
Typeable Province Portugal 
Typeable Province NorthAfrica 
Typeable Province Norway 
Typeable Province Holland 
Typeable Province Greece 
Typeable Province Finland 
Typeable Province Bulgaria 
Typeable Province Belgium 
Typeable Province Albania 
Typeable Province Syria 
Typeable Province Smyrna 
Typeable Province Constantinople 
Typeable Province Armenia 
Typeable Province Ankara 
Typeable Province Warsaw 
Typeable Province Ukraine 
Typeable Province StPetersburg 
Typeable Province Sevastopol 
Typeable Province Moscow 
Typeable Province Livonia 
Typeable Province Venice 
Typeable Province Tuscany 
Typeable Province Rome 
Typeable Province Piedmont 
Typeable Province Naples 
Typeable Province Apulia 
Typeable Province Silesia 
Typeable Province Ruhr 
Typeable Province Prussia 
Typeable Province Munich 
Typeable Province Kiel 
Typeable Province Berlin 
Typeable Province Picardy 
Typeable Province Paris 
Typeable Province Marseilles 
Typeable Province Gascony 
Typeable Province Burgundy 
Typeable Province Brest 
Typeable Province Yorkshire 
Typeable Province Wales 
Typeable Province London 
Typeable Province Liverpool 
Typeable Province Edinburgh 
Typeable Province Clyde 
Typeable Province Vienna 
Typeable Province Tyrolia 
Typeable Province Trieste 
Typeable Province Galicia 
Typeable Province Budapest 
Typeable Province Bohemia 
Typeable (Province -> ProvinceTarget) Normal 

adjacency :: Province -> [Province] Source

A Province p is adjacent to (borders) all Provinces in adjacency p. This is symmetric and antireflexive.

neighbours :: ProvinceTarget -> [ProvinceTarget] Source

This is like adjacency but for ProvinceTargets, and takes into consideration the special cases of multi-coast Provinces.

commonCoasts :: ProvinceTarget -> ProvinceTarget -> [ProvinceTarget] Source

Common neighbours which are water provinces.

supplyCentre :: Province -> Bool Source

Indicates whether a Province is a supply centre.

supplyCentres :: [Province] Source

All supply centres.

country :: Province -> Maybe GreatPower Source

Some provinces belong to a country. This is useful in conjunction with supplyCentre to determine which provinces can be used by a given country to build a unit. It is distinct from the in-game notion of control. Although Brest belongs to France, it may be controlled by some other power.

pcProvince :: ProvinceCoast -> Province Source

The Province to which a ProvinceCoast belongs.

provinceCoasts :: Province -> [ProvinceCoast] Source

The ProvinceCoasts which belong to a Province.

provinceTargets :: Province -> [ProvinceTarget] Source

All ProvinceTargets associated with a Province. For Provinces with 0 or 1 coast, provinceTargets p = [Normal p].

provinceTargetCluster :: ProvinceTarget -> [ProvinceTarget] Source

All ProvinceTargets which belong to the same Province as this one.

paths :: (Province -> Bool) -> (Province -> Maybe t) -> [Province] -> [(t, Province, [Province])] Source

A search from a list of Provinces, via 1 or more adjacent Provinces which satisfy some indicator, until another indicator is satisfied. This gives simple paths from those Provinces, via Provinces which satisfy the first indicator, to Provinces which satisfy the second indicator.

Example use case: convoy paths from a given Province.

    convoyPaths
        :: Occupation
        -> Province
        -> [(Province, [Province])]
    convoyPaths occupation convoyingFrom =
        fmap
            ((x, y, zs) -> (x, y : zs))
            (paths (occupiedByFleet occupation) (coastalIndicator) [convoyingFrom])