Skinney / elm-warrior / Warrior.Program

Contains the essential logic for rendering and defining the game. The Map and Player modules will be of more interest for programming your warrior.


type alias TurnFunction =
Warrior -> Warrior.Internal.Map.Map -> Warrior.Internal.History.History -> Warrior.Action

The type signature of a turn function. Turn functions with decide the actions of a Warrior.


type Model

The game model.


type Msg

The game message type.


type alias Config =
{ maps : List Warrior.Map.Builder.Template
, players : List ( String
, TurnFunction )
, msPerTurn : Basics.Float
, progressionFunction : Warrior.Map.Progression.ProgressionFunction 
}

This configuration decides what kind of game you'll play. You can find a bunch of pre-made maps in the Warrior.Maps module, unless you want to make your own. For players you can add a list of ( PlayerName, TurnFunction ). You can decide how long to wait between turns using the msPerTurn field. Finally, the progressionFunction decides when the game is over, or when it is won. You can find some progressionFunctions in Warrior.Maps.Progression.

program : Config -> Platform.Program () Model Msg

Start a program with a given config.