ostrat.prid

package ostrat.prid

Type members

Classlikes

implicit
class GridSlateScaleExtension[T](value: T)(implicit grid: TGrid, evSlate: Slate[T], evScale: Scale[T])

The state of a simultaneous turn tile grid scenario.

The state of a simultaneous turn tile grid scenario.

class HCen(val r: Int, val c: Int) extends HCenOrSide

A Hex tile centre hexG grid HGrid coordinate.

A Hex tile centre hexG grid HGrid coordinate.

Companion
object
object HCen

Companion object of HCen trait, contains HVert values for hex tile 0, 0. As well as apply method and Show implicit.

Companion object of HCen trait, contains HVert values for hex tile 0, 0. As well as apply method and Show implicit.

Companion
class
class HCenArr[A <: AnyRef](val unsafeArr: Array[A])

An array of hex tile or hex centre data. For efficiency the data is stored as a flat Array. No run time information distinguishes this from an ordinary linear sequence array of data. Whether in a game or a non game application the data of the grid tiles is likely to change much more frequently than the size, shape, structure of the grid. The compiler knows this is hex grid array and hence the data should be set and retrieved through the HGrid hex grid. So nearly all the methods take the HGrid as an implicit parameter.

An array of hex tile or hex centre data. For efficiency the data is stored as a flat Array. No run time information distinguishes this from an ordinary linear sequence array of data. Whether in a game or a non game application the data of the grid tiles is likely to change much more frequently than the size, shape, structure of the grid. The compiler knows this is hex grid array and hence the data should be set and retrieved through the HGrid hex grid. So nearly all the methods take the HGrid as an implicit parameter.

Companion
object
object HCenArr

Companion object for HCenArr, contains an apply factory method.

Companion object for HCenArr, contains an apply factory method.

Companion
class
class HCenArrArr[A](val unsafeArray: Array[Array[A]])

A Hex grid array class of Arrs.

A Hex grid array class of Arrs.

class HCenArrOfBuff[A <: AnyRef](val unsafeArr: Array[ArrayBuffer[A]])

An HCen hex tile centre grid Arr of ArrayBuffers corresponding to the centres of an HGrid hex tile grid.

An HCen hex tile centre grid Arr of ArrayBuffers corresponding to the centres of an HGrid hex tile grid.

Companion
object

Companion object for the hex (centres) grid Array of ArrayBuffer classes.

Companion object for the hex (centres) grid Array of ArrayBuffer classes.

Companion
class
final
class HCenArrOpt[A <: AnyRef](val unsafeArr: Array[A]) extends AnyVal with TileArrOpt[A]

An immutable Arr of Opt Tile data for a specific hex tile grid HGrid. This is specialised for OptRef[A]. The tileGrid can map the HCen coordinate of the tile to the index of the Arr. Hence most methods take an implicit HGrid hex grid parameter.

An immutable Arr of Opt Tile data for a specific hex tile grid HGrid. This is specialised for OptRef[A]. The tileGrid can map the HCen coordinate of the tile to the index of the Arr. Hence most methods take an implicit HGrid hex grid parameter.

final
class HCenBuff(val unsafeBuff: ArrayBuffer[Int]) extends AnyVal with BuffInt2s[HCen]
trait HCenOrSide extends HCoord

Common trait for hex centre and hex side coordinate. The position of these coordinates is proportional, unlike the Hex vertices positions.

Common trait for hex centre and hex side coordinate. The position of these coordinates is proportional, unlike the Hex vertices positions.

final
class HCenPath(val arrayUnsafe: Array[Int]) extends AnyVal with HCenPathTr
case
class HCenRow(r: Int, c: Int, num: Int) extends HCenRowLike

A row or a segment a row of Hex tiles in a grid. The start / left centre HexGrid coordinate and the number of tiles in the row..

A row or a segment a row of Hex tiles in a grid. The start / left centre HexGrid coordinate and the number of tiles in the row..

case
class HCenRowValue[A](r: Int, c: Int, num: Int, value: A) extends HCenRowLike
final
class HCens(val arrayUnsafe: Array[Int]) extends AnyVal with ArrInt2s[HCen]

An efficient array[Int] based collection for HCens hex grid centre coordinates.

An efficient array[Int] based collection for HCens hex grid centre coordinates.

Companion
object

Companion object for HCens trait efficient array[Int] based collection for HCens hex grid centre coordinates, contains factory apply and uninitialised methods..

Companion object for HCens trait efficient array[Int] based collection for HCens hex grid centre coordinates, contains factory apply and uninitialised methods..

Companion
class
trait HCoord extends TCoord

A coordinate with in a Hex grid. It may be a Hex tile centre HCen, a HexSide HSide or Hex tile vertice HVert.

A coordinate with in a Hex grid. It may be a Hex tile centre HCen, a HexSide HSide or Hex tile vertice HVert.

Companion
object
object HCoord

Companion object for Hex coordinate trait, contains apply factory object.

Companion object for Hex coordinate trait, contains apply factory object.

Companion
class
final
class HCoordBuff(val unsafeBuff: ArrayBuffer[Int]) extends AnyVal with BuffInt2s[HCoord]
case
class HCoordLineSeg(r1: Int, c1: Int, r2: Int, c2: Int)

A 2d line upon a HexGrid defined by its start and end HGrid HCoords.

A 2d line upon a HexGrid defined by its start and end HGrid HCoords.

Companion
object
Companion
class
final
class HCoords(val arrayUnsafe: Array[Int]) extends AnyVal with ArrInt2s[HCoord]
trait HGrid extends TGrid with HGridBased

A grid of Hexs. The grid may be a regular rectangle of hexs or an irregular grid with variable length rows.

A grid of Hexs. The grid may be a regular rectangle of hexs or an irregular grid with variable length rows.

trait HGridIrr extends HGrid

An irregular hex grid, where the rows have different lengths and irregular start row coordinates. This is backed by an Array[Int] The (0) value gives the number of tile centre HCen rows. The (1) value gives the rTileMin the bottom row coordinate. There are 2 more values for row. Each row from lowest to highest has two values length of the row in the number of tile centres HCens and the rTileMin coordinate for the row.

An irregular hex grid, where the rows have different lengths and irregular start row coordinates. This is backed by an Array[Int] The (0) value gives the number of tile centre HCen rows. The (1) value gives the rTileMin the bottom row coordinate. There are 2 more values for row. Each row from lowest to highest has two values length of the row in the number of tile centres HCens and the rTileMin coordinate for the row.

class HGridIrrRowLengths(val unsafeArray: Array[Int]) extends HGridIrr

An irregular hex grid, where the rows have different lengths and irregular start row coordinates. This is backed by an Array[Int] The (0) value gives the number of tile centre HCen rows. The (1) value gives the rTileMin the bottom row coordinate. There are 2 more values for row. Each row from lowest to highest has two values length of the row in the number of tile centres HCens and the rTileMin coordinate for the row.

An irregular hex grid, where the rows have different lengths and irregular start row coordinates. This is backed by an Array[Int] The (0) value gives the number of tile centre HCen rows. The (1) value gives the rTileMin the bottom row coordinate. There are 2 more values for row. Each row from lowest to highest has two values length of the row in the number of tile centres HCens and the rTileMin coordinate for the row.

Value Params
tileRowsStartEnd

the Array contains 2 values per Tile Row, the cStart Tile and the cEnd Tile

yTileMin

The y value for the bottom tile row of the TileGrid

Constructor

creates a new HexGridIrr with a defined grid.

Companion
object
Companion
class
class HGridReg(val bottomTileRow: Int, val topTileRow: Int, val tileColMin: Int, val tileColMax: Int) extends HGrid

A Regular hex grid where the tile rows have the same length, except the tile rows where r %% 4 == 2 may differ in length by 1 from tile rows where r %% 4 == 0 rows.

A Regular hex grid where the tile rows have the same length, except the tile rows where r %% 4 == 2 may differ in length by 1 from tile rows where r %% 4 == 0 rows.

Companion
object
object HGridReg

Companion object for the HGridReg class. Contains an applr method that corrects the r and Y minimum and maximum values.

Companion object for the HGridReg class. Contains an applr method that corrects the r and Y minimum and maximum values.

Companion
class
trait HGrids
class HGridsFlat(val grids: Arr[HGrid]) extends HGrids
class HSide(val r: Int, val c: Int) extends HCenOrSide

A Hex side coordinate in a Hex Grid. So Side 1 on its primary Hex tile goes from Vert 6 to 1 while it is Side 4 on its secondary Hex tile and goes from Vertex 4 to vertex 3 So Side 2 on its primary Hex tile goes from Vert 1 to 2 while it is Side 5 on its secondary Hex tile and goes from Vertex 5 to vertex 4 So Side 3 on its primary Hex tile goes from Vert 2 to 3 while it is Side 4 on its secondary Hex tile and goes from Vertex 6 to vertex 4

A Hex side coordinate in a Hex Grid. So Side 1 on its primary Hex tile goes from Vert 6 to 1 while it is Side 4 on its secondary Hex tile and goes from Vertex 4 to vertex 3 So Side 2 on its primary Hex tile goes from Vert 1 to 2 while it is Side 5 on its secondary Hex tile and goes from Vertex 5 to vertex 4 So Side 3 on its primary Hex tile goes from Vert 2 to 3 while it is Side 4 on its secondary Hex tile and goes from Vertex 6 to vertex 4

Companion
object
object HSide

Companion object for the HSide class, provides an apply factory method that throws an exception for an invalid Hex side coordinate.

Companion object for the HSide class, provides an apply factory method that throws an exception for an invalid Hex side coordinate.

Companion
class
class HSideArr[A <: AnyRef](val unsafeArr: Array[A])
final
class HSideBooleans(val unsafeArray: Array[Boolean]) extends AnyVal

Boolean data corresponding to the sides of a hex grid, stored using an underlying Array[Boolean]. Thhese classes should be created, initalised and used using an [HGrid]] class. For convenience the HGrid is passed as an implicit parameter.

Boolean data corresponding to the sides of a hex grid, stored using an underlying Array[Boolean]. Thhese classes should be created, initalised and used using an [HGrid]] class. For convenience the HGrid is passed as an implicit parameter.

final
class HSides(val arrayUnsafe: Array[Int]) extends AnyVal with ArrInt2s[HSide]

An efficient array[Int] based collection for HSides hex grid centre coordinates.

An efficient array[Int] based collection for HSides hex grid centre coordinates.

Companion
object

Companion object for HSides trait efficient array[Int] based collection for HSides hex grid centre coordinates, contains factory apply and uninitialised methods.

Companion object for HSides trait efficient array[Int] based collection for HSides hex grid centre coordinates, contains factory apply and uninitialised methods.

Companion
class
sealed
trait HStep extends TileStep with ElemInt1

A step on a hex tile grid HGrid can take 6 values: upright right, downright, downleft, left and upleft.

A step on a hex tile grid HGrid can take 6 values: upright right, downright, downleft, left and upleft.

Companion
object
object HStep
Companion
class
case
object HStepDL extends HStep

A step downleft on a hex tile grid HGrid.

A step downleft on a hex tile grid HGrid.

case
object HStepDR extends HStep

A step downright on a hex tile grid HGrid.

A step downright on a hex tile grid HGrid.

case
object HStepLt extends HStep

A step left on a hex tile grid HGrid.

A step left on a hex tile grid HGrid.

case
object HStepRt extends HStep

A step right on a hex tile grid HGrid.

A step right on a hex tile grid HGrid.

case
object HStepUL extends HStep

A step upleft on a hex tile grid HGrid.

A step upleft on a hex tile grid HGrid.

case
object HStepUR extends HStep

A step upright on a hex tile grid HGrid.

A step upright on a hex tile grid HGrid.

final
class HSteps(val arrayUnsafe: Array[Int]) extends AnyVal with ArrInt1s[HStep] with HStepsTr
Companion
object
object HSteps extends HStepsCompanion[HSteps]
Companion
class
trait HStepsTr

A trait for HSteps. The purpose of the trait rather than a class is to allow the consumer to mix in their own traits. Its not clear whether this is useful in Scala 3 or its bettter to use union types with the HSteps class.

A trait for HSteps. The purpose of the trait rather than a class is to allow the consumer to mix in their own traits. Its not clear whether this is useful in Scala 3 or its bettter to use union types with the HSteps class.

final
class HVert extends AnyVal with HCoord with ElemInt2

A hex tile vertex coordinate.

A hex tile vertex coordinate.

Companion
object
object HVert
Companion
class
final
class HVertBuff(val unsafeBuff: ArrayBuffer[Int]) extends AnyVal with BuffInt2s[HVert]
final
class HVerts(val arrayUnsafe: Array[Int]) extends AnyVal with HVertsLike with ArrInt2s[HVert]

An array[Int] based collection for HVert.

An array[Int] based collection for HVert.

Companion
object
Companion
class
trait HVertsLike extends DataInt2s[HVert]

Common trait for Hverts and PolygonHC

Common trait for Hverts and PolygonHC

case
class HexAndStep(r1: Int, c1: Int, step: HStep)

Hex centre coordinate and hex step.

Hex centre coordinate and hex step.

Companion
object
object HexAndStep
Companion
class
trait HexMem[A]
implicit
class IntGridImplicit(thisInt: Int)
case
class Node(tile: HCen, var gCost: Int, var hCost: Int, var parent: OptRef[Node])
final
class PolygonHC(val arrayUnsafe: Array[Int]) extends AnyVal with PolygonInt2s[HCoord]

A polygon with the vertices defined by hex tile corrdinates HCoords.

A polygon with the vertices defined by hex tile corrdinates HCoords.

Companion
object

Companion object for the polygon whose vertices are defined by hex tile coordinates PolygonHC trait.

Companion object for the polygon whose vertices are defined by hex tile coordinates PolygonHC trait.

Companion
class
case
class SqAndStep(r1: Int, c1: Int, step: SqStep)
case
class SqCen(r: Int, c: Int) extends SqCoord

A Square tile centre square grid SqGrid coordinate.

A Square tile centre square grid SqGrid coordinate.

final
class SqCenArr[A <: AnyRef](val unsafeArr: Array[A]) extends AnyVal

An array of hex tile or hex centre data.

An array of hex tile or hex centre data.

Companion
object
object SqCenArr
Companion
class
class SqCenArrBuff[A <: AnyRef](val unsafeArr: Array[ArrayBuffer[A]])

An Array of ArrayBuffers corresponding to (the centres of a) Hex tile Grid.

An Array of ArrayBuffers corresponding to (the centres of a) Hex tile Grid.

Companion
object

Companion object for the Hex (centres) grid Array of ArrayBuffer classes.

Companion object for the Hex (centres) grid Array of ArrayBuffer classes.

Companion
class
final
class SqCenArrOpt[A <: AnyRef](val unsafeArr: Array[A]) extends AnyVal with TileArrOpt[A]

An immutable Arr of Opt Tile data for a specific square tile grid SqGrid. This is specialised for OptRef[A]. The tileGrid can map the SqCen coordinate of the tile to the index of the Arr. Hence most methods take an implicit SqGrid square grid parameter.

An immutable Arr of Opt Tile data for a specific square tile grid SqGrid. This is specialised for OptRef[A]. The tileGrid can map the SqCen coordinate of the tile to the index of the Arr. Hence most methods take an implicit SqGrid square grid parameter.

trait SqCoord extends TCoord

A square grid integer tile coordinate.

A square grid integer tile coordinate.

final
class SqGrid(val bottomTileRow: Int, val topTileRow: Int, val tileColMin: Int, val tileColMax: Int) extends TGrid

A grid of Squares. A regular rectangle of squares.

A grid of Squares. A regular rectangle of squares.

Companion
object
object SqGrid

Companion object for the HGridReg class. Contains an applr method that corrects the r and Y minimum and maximum values.

Companion object for the HGridReg class. Contains an applr method that corrects the r and Y minimum and maximum values.

Companion
class
trait SqGridScen extends GridTurnScen
trait SqMem[A]
class SqSide(val r: Int, val c: Int) extends SqCoord

A Square tile side square grid SqGrid coordinate.

A Square tile side square grid SqGrid coordinate.

sealed
trait SqStep extends TileStep

A square tile step can take 8 values

A square tile step can take 8 values

case
object SqStepDL extends SqStepDiag
case
object SqStepDR extends SqStepDiag
sealed
trait SqStepDiag extends SqStep

A non-diagonal square tile Step can take 4 values.

A non-diagonal square tile Step can take 4 values.

case
object SqStepDn extends SqStepNear

An downward step / move / addition of one square tile in a square tile grid.

An downward step / move / addition of one square tile in a square tile grid.

case
object SqStepLt extends SqStepNear

An upward of one square tile in a square tile grid.

An upward of one square tile in a square tile grid.

sealed
trait SqStepNear extends SqStep

A non-diagonal square tile Step can take 4 values.

A non-diagonal square tile Step can take 4 values.

case
object SqStepRt extends SqStepNear

An rightward step / move / addition of one square tile in a square tile grid. Increases the column coordinate by 2

An rightward step / move / addition of one square tile in a square tile grid. Increases the column coordinate by 2

case
object SqStepUL extends SqStepDiag
case
object SqStepUR extends SqStepDiag
case
object SqStepUp extends SqStepNear

An upward step / move addition of one square tile in a square tile grid. Increases the row coordinate by 2.

An upward step / move addition of one square tile in a square tile grid. Increases the row coordinate by 2.

class SqVert(val r: Int, val c: Int) extends SqCoord

A Square tile vertex square grid SqGrid coordinate.

A Square tile vertex square grid SqGrid coordinate.

Companion
object
object SqVert
Companion
class
trait TCoord extends Show2Base32s

A coordinate in a tile grid TGrid. The row is the first field, the column is the second.

A coordinate in a tile grid TGrid. The row is the first field, the column is the second.

Companion
object
object TCoord

Companion object for TCoord trait will contain a Show[TCoord] implicit instance in Scala 3, but this produces an error in 2.13.5.

Companion object for TCoord trait will contain a Show[TCoord] implicit instance in Scala 3, but this produces an error in 2.13.5.

Companion
class
trait TGrid

A TileGrid is a description of an abstract TileGrid. It contains no data for the elements of any particular TileGrid. The Data for TileGrids is stored in flat arrays. The TileGrid gives the dimensions of a tileGrid. It has methods to interpret the data in flat Arrays created for that TileGrid specification. It has methods to map the elements of an Array to the the 2 dimensional geometry of the Tile Grid. On its own a TileGrid can produce the outlines of the grid, coordinates vector positions and other pure mathematical data. Combined with a simple function it can for example produce a Chess board. Combined with a 64 length array it can produce a Chess board position. For anything but the most simple games, you will probably want multiple arrays to describe the game state. The terrain for example may remain invariant, so the terrain data does not need to be reproduced with every move.

A TileGrid is a description of an abstract TileGrid. It contains no data for the elements of any particular TileGrid. The Data for TileGrids is stored in flat arrays. The TileGrid gives the dimensions of a tileGrid. It has methods to interpret the data in flat Arrays created for that TileGrid specification. It has methods to map the elements of an Array to the the 2 dimensional geometry of the Tile Grid. On its own a TileGrid can produce the outlines of the grid, coordinates vector positions and other pure mathematical data. Combined with a simple function it can for example produce a Chess board. Combined with a 64 length array it can produce a Chess board position. For anything but the most simple games, you will probably want multiple arrays to describe the game state. The terrain for example may remain invariant, so the terrain data does not need to be reproduced with every move.

A TileGrid is for use cases where the proportions of the Grid predetermine the proportions of the visual representation, as opposed to a use case where the proportions of the enclosing space are a factor in determining the proportions of the grid. For example the various grid layouts of the Stars on the American flag.

trait TileArrOpt[A <: AnyRef]
trait TileStep

A tile step, move or addition, or no move.

A tile step, move or addition, or no move.

Value members

Concrete fields

The hex centre step values.

The hex centre step values.

The square centre step values.

The square centre step values.

Implicits

Implicits

final implicit
def GridSlateScaleExtension[T](value: T)(implicit grid: TGrid, evSlate: Slate[T], evScale: Scale[T]): GridSlateScaleExtension[T]
final implicit
def IntGridImplicit(thisInt: Int): IntGridImplicit