robinheghan / elm-warrior / Warrior.Map.Tile

A map is built of several tiles. You can use this module to get a better idea of how the map is made up.


type Tile
    = Wall
    | Empty
    | SpawnPoint
    | Exit
    | Warrior String
    | Item Warrior.Item.Item

Describes what is on a specific coordinate of a map.

Predicates

Sometimes a pattern match is a bit much when all you want is the answer to a simple question. So here are simple predicate functions that make it easy to answer the most basic question about a tile.

isWall : Tile -> Basics.Bool

True if the given Tile is a Wall

isEmpty : Tile -> Basics.Bool

True if the given Tile represents Empty space

isSpawnPoint : Tile -> Basics.Bool

True if the given Tile is a spawn point

isExit : Tile -> Basics.Bool

True if the given Tile is an exit point

isWarrior : Tile -> Basics.Bool

True if the given Tile represents another warrior

isItem : Tile -> Basics.Bool

True if the given Tile represents an item

canMoveOnto : Tile -> Basics.Bool

True if a warrior can move to this tile with a move action.