| Copyright | (c) Alexander Vieth, 2015 |
|---|---|
| License | BSD3 |
| Maintainer | aovieth@gmail.com |
| Stability | experimental |
| Portability | non-portable (GHC only) |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Diplomacy.Province
Description
- data Province
- = Bohemia
- | Budapest
- | Galicia
- | Trieste
- | Tyrolia
- | Vienna
- | Clyde
- | Edinburgh
- | Liverpool
- | London
- | Wales
- | Yorkshire
- | Brest
- | Burgundy
- | Gascony
- | Marseilles
- | Paris
- | Picardy
- | Berlin
- | Kiel
- | Munich
- | Prussia
- | Ruhr
- | Silesia
- | Apulia
- | Naples
- | Piedmont
- | Rome
- | Tuscany
- | Venice
- | Livonia
- | Moscow
- | Sevastopol
- | StPetersburg
- | Ukraine
- | Warsaw
- | Ankara
- | Armenia
- | Constantinople
- | Smyrna
- | Syria
- | Albania
- | Belgium
- | Bulgaria
- | Finland
- | Greece
- | Holland
- | Norway
- | NorthAfrica
- | Portugal
- | Rumania
- | Serbia
- | Spain
- | Sweden
- | Tunis
- | Denmark
- | AdriaticSea
- | AegeanSea
- | BalticSea
- | BarentsSea
- | BlackSea
- | EasternMediterranean
- | EnglishChannel
- | GulfOfBothnia
- | GulfOfLyon
- | HeligolandBight
- | IonianSea
- | IrishSea
- | MidAtlanticOcean
- | NorthAtlanticOcean
- | NorthSea
- | NorwegianSea
- | Skagerrak
- | TyrrhenianSea
- | WesternMediterranean
- adjacency :: Province -> [Province]
- adjacent :: Province -> Province -> Bool
- isSameOrAdjacent :: Province -> Province -> Bool
- neighbours :: ProvinceTarget -> [ProvinceTarget]
- isSameOrNeighbour :: ProvinceTarget -> ProvinceTarget -> Bool
- provinceCommonNeighbours :: Province -> Province -> [Province]
- provinceCommonCoasts :: Province -> Province -> [Province]
- commonNeighbours :: ProvinceTarget -> ProvinceTarget -> [ProvinceTarget]
- commonCoasts :: ProvinceTarget -> ProvinceTarget -> [ProvinceTarget]
- data ProvinceType
- provinceType :: Province -> ProvinceType
- supplyCentre :: Province -> Bool
- supplyCentres :: [Province]
- isCoastal :: Province -> Bool
- isInland :: Province -> Bool
- isWater :: Province -> Bool
- country :: Province -> Maybe GreatPower
- isHome :: GreatPower -> Province -> Bool
- data ProvinceCoast
- pcProvince :: ProvinceCoast -> Province
- provinceCoasts :: Province -> [ProvinceCoast]
- data ProvinceTarget
- isNormal :: ProvinceTarget -> Bool
- isSpecial :: ProvinceTarget -> Bool
- ptProvince :: ProvinceTarget -> Province
- provinceTargets :: Province -> [ProvinceTarget]
- provinceTargetCluster :: ProvinceTarget -> [ProvinceTarget]
- shortestPath :: Province -> Province -> [Province]
- distance :: Province -> Province -> Int
- distanceFromHomeSupplyCentre :: GreatPower -> Province -> Int
- parseProvince :: Parser Province
- parseProvinceTarget :: Parser ProvinceTarget
- printProvince :: IsString a => Province -> a
- printProvinceTarget :: IsString a => ProvinceTarget -> a
- paths :: (Province -> Bool) -> (Province -> Maybe t) -> [Province] -> [(t, Province, [Province])]
Documentation
Enumeration of the places on the diplomacy board.
Constructors
Instances
adjacency :: Province -> [Province] Source
A Province p is adjacent to (borders) all Provinces in adjacency p.
This is symmetric and antireflexive.
isSameOrAdjacent :: Province -> Province -> Bool Source
neighbours :: ProvinceTarget -> [ProvinceTarget] Source
This is like adjacency but for ProvinceTargets,
and takes into consideration the special cases of multi-coast Provinces.
provinceCommonNeighbours :: Province -> Province -> [Province] Source
provinceCommonCoasts :: Province -> Province -> [Province] Source
commonCoasts :: ProvinceTarget -> ProvinceTarget -> [ProvinceTarget] Source
Common neighbours which are water provinces.
data ProvinceType Source
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.
isHome :: GreatPower -> Province -> Bool Source
data ProvinceCoast Source
These are the special coasts, for Provinces which have more than one
coast.
Instances
pcProvince :: ProvinceCoast -> Province Source
The Province to which a ProvinceCoast belongs.
provinceCoasts :: Province -> [ProvinceCoast] Source
The ProvinceCoasts which belong to a Province.
data ProvinceTarget Source
This type contains all places where some unit could be stationed.
Constructors
| Normal Province | |
| Special ProvinceCoast |
isNormal :: ProvinceTarget -> Bool Source
isSpecial :: ProvinceTarget -> Bool Source
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.
shortestPath :: Province -> Province -> [Province] Source
printProvince :: IsString a => Province -> a Source
printProvinceTarget :: IsString a => ProvinceTarget -> a Source
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])