bishbosh-0.0.0.3: Plays chess.

BishBosh.Attribute.Direction

Description

AUTHOR
Dr. Alistair Ward
DESCRIPTION
• Describes a direction in two parts; the sense of change in the x coordinate & the sense of change in the y coordinate.
• The IO-format uses a more concise & familiar format based on 8 points of the compass.
• CAVEAT: this separation of direction into orthogonal components is driven by the typical use-case, but requires that one guards against accidental construction of a degenerate 9th direction which defines neither a change in the x coordinate nor the y coordinate.

Synopsis

# Types

## Type-synonyms

A number of directions.

A boxed array indexed by direction, of arbitrary elements.

## Data-types

data Direction Source #

Define a direction by the sense of change to x & y coordinates.

Instances

 Source # Methods Source # Methods Source # Methods Source # Methods Source # MethodsshowList :: [Direction] -> ShowS # Source # Methodsrange :: (Direction, Direction) -> [Direction] #index :: (Direction, Direction) -> Direction -> Int #unsafeIndex :: (Direction, Direction) -> Direction -> IntinRange :: (Direction, Direction) -> Direction -> Bool #rangeSize :: (Direction, Direction) -> Int #unsafeRangeSize :: (Direction, Direction) -> Int Source # Methods Source # Methods Source # Methods Source # Methods Source # Methods

# Constants

Constant direction.

Constant direction.

Constant direction.

Constant direction.

Constant direction.

Constant direction.

Constant direction.

Constant direction.

Used to qualify XML.

The constant number of distinct directions.

The ordered directions in which a Rook can move.

The ordered directions in which a Bishop can move.

The ordered directions in which royalty can move.

• Returns a list of directions, each paired with its anti-parallel.
• CAVEAT: each direction only appears once in the list, on an arbitrary side of a pair.

# Functions

The y-direction in which a Pawn of the specified logical colour advances.

The directions in which a Pawn can attack.

listArrayByDirection :: IArray a e => [e] -> a Direction e Source #

Array-constructor.

## Constructor

Arguments

 :: Ordering The sense of the change in the x-coordinate. -> Ordering The sense of the change in the y-coordinate. -> Direction

Smart-constructor.

## Predicates

Whether the two directions specified, are either parallel or anti-parallel.