LambdaHack-0.8.1.2: A game engine library for tactical squad ASCII roguelike dungeon crawlers

Safe HaskellNone
LanguageHaskell2010

Game.LambdaHack.Client.Bfs

Contents

Description

Breadth first search algorithm.

Synopsis

Documentation

data BfsDistance Source #

Weighted distance between points along shortest paths.

Instances
Enum BfsDistance Source # 
Instance details

Defined in Game.LambdaHack.Client.Bfs

Eq BfsDistance Source # 
Instance details

Defined in Game.LambdaHack.Client.Bfs

Ord BfsDistance Source # 
Instance details

Defined in Game.LambdaHack.Client.Bfs

Show BfsDistance Source # 
Instance details

Defined in Game.LambdaHack.Client.Bfs

Bits BfsDistance Source # 
Instance details

Defined in Game.LambdaHack.Client.Bfs

UnboxRepClass BfsDistance Source # 
Instance details

Defined in Game.LambdaHack.Client.Bfs

Associated Types

type UnboxRep BfsDistance :: * Source #

type UnboxRep BfsDistance Source # 
Instance details

Defined in Game.LambdaHack.Client.Bfs

data MoveLegal Source #

State of legality of moves between adjacent points.

Instances
Eq MoveLegal Source # 
Instance details

Defined in Game.LambdaHack.Client.Bfs

minKnownBfs :: BfsDistance Source #

The minimal distance value assigned to paths that don't enter any unknown tiles.

apartBfs :: BfsDistance Source #

The distance value that denotes no legal path between points, either due to blocked tiles or pathfinding aborted at earlier tiles, e.g., due to unknown tiles.

maxBfsDistance :: BfsDistance Source #

Maximum value of the type.

fillBfs Source #

Arguments

:: Array Word8 
-> Word8 
-> Point

starting position

-> Array BfsDistance

initial array, with apartBfs

-> () 

Fill out the given BFS array. Unsafe PointArray operations are OK here, because the intermediate values of the vector don't leak anywhere outside nor are kept unevaluated and so they can't be overwritten by the unsafe side-effect.

When computing move cost, we assume doors openable at no cost, because other actors use them, too, so the cost is shared and the extra visiblity is valuable, too. We treat unknown tiles specially. Whether suspect tiles are considered openable depends on smarkSuspect.

data AndPath Source #

Constructors

AndPath 

Fields

NoPath 
Instances
Show AndPath Source # 
Instance details

Defined in Game.LambdaHack.Client.Bfs

Generic AndPath Source # 
Instance details

Defined in Game.LambdaHack.Client.Bfs

Associated Types

type Rep AndPath :: * -> * #

Methods

from :: AndPath -> Rep AndPath x #

to :: Rep AndPath x -> AndPath #

Binary AndPath Source # 
Instance details

Defined in Game.LambdaHack.Client.Bfs

Methods

put :: AndPath -> Put #

get :: Get AndPath #

putList :: [AndPath] -> Put #

type Rep AndPath Source # 
Instance details

Defined in Game.LambdaHack.Client.Bfs

type Rep AndPath = D1 (MetaData "AndPath" "Game.LambdaHack.Client.Bfs" "LambdaHack-0.8.1.2-9Fmfvbfsr9xEInnejydwaW" False) (C1 (MetaCons "AndPath" PrefixI True) (S1 (MetaSel (Just "pathList") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 [Point]) :*: (S1 (MetaSel (Just "pathGoal") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Point) :*: S1 (MetaSel (Just "pathLen") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Int))) :+: C1 (MetaCons "NoPath" PrefixI False) (U1 :: * -> *))

findPathBfs :: Array Word8 -> (Point -> Bool) -> Point -> Point -> Int -> Array BfsDistance -> AndPath Source #

Find a path, without the source position, with the smallest length. The eps coefficient determines which direction (of the closest directions available) that path should prefer, where 0 means north-west and 1 means north.

accessBfs :: Array BfsDistance -> Point -> Maybe Int Source #

Access a BFS array and interpret the looked up distance value.

Internal operations

abortedKnownBfs :: BfsDistance Source #

The distance value that denotes that path search was aborted at this tile due to too large actual distance and that the tile was known and not blocked. It is also a true distance value for this tile (shifted by minKnownBfs, as all distances of known tiles).

abortedUnknownBfs :: BfsDistance Source #

The distance value that denotes that path search was aborted at this tile due to too large actual distance and that the tile was unknown. It is also a true distance value for this tile.