ostrat.prid

package ostrat.prid

Type members

Classlikes

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 HexGrid coordinate.

A Hex tile centre HexGrid 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.

An array of hex tile or hex centre data.

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 HCenArrBuff[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
object HCenArrBuff

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

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.

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.

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 Int2sArr[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
object HCens extends Int2sArrCompanion[HCen, HCens]

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
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
trait HGrid extends TGrid

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. This grid is irregular in the length of the hex rows.

An irregular hex grid. This grid is irregular in the length of the hex rows.

Companion
object
object HGridIrr
Companion
class
case class HGridIrrRowLengths(unsafeArray: Array[Int]) 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.

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.

class HGridReg(val rCenMin: Int, val rCenMax: Int, val cTileMin: Int, val cTileMax: Int) extends HGrid

A Regular hex grid where the rows have the same length, except div4rem2 rows may differ in length by 1 from div4rem0 rows. A div4rem2 row is where the y coordinate divided by 4 has a remainder of 2. This class replaces the old HexGridReg, which used Roords rather than HCens etc.

A Regular hex grid where the rows have the same length, except div4rem2 rows may differ in length by 1 from div4rem0 rows. A div4rem2 row is where the y coordinate divided by 4 has a remainder of 2. This class replaces the old HexGridReg, which used Roords rather than HCens etc.

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
case class HPlayer(value: Player, hc: HCen) extends HexMem[Player]

A class identifying a Player and a hex coordinate position.

A class identifying a Player and a hex coordinate position.

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 Int2sArr[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
final class HVert extends AnyVal with HCoord with Int2Elem
Companion
object
object HVert
Companion
class
final class HVertBuff(val buffer: ArrayBuffer[Int]) extends AnyVal with Int2sBuffer[HVert, HVerts]
final class HVertPolygon(val arrayUnsafe: Array[Int]) extends AnyVal with HVertsLike
Companion
object
final class HVerts(val arrayUnsafe: Array[Int]) extends AnyVal with HVertsLike

An array[Int] based collection for HVert.

An array[Int] based collection for HVert.

Companion
object
Companion
class
trait HVertsLike extends Int2sArr[HVert]

Common trait for Hverts and HVertPolygon

Common trait for Hverts and HVertPolygon

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

Hex centre coordinate and hex step.

Hex centre coordinate and hex step.

trait HexGridScen extends GridTurnScen
trait HexMem[A]
sealed trait HexStep extends HexStepOpt

A hex tile step can take 6 values.

A hex tile step can take 6 values.

case object HexStepDL extends HexStep

hex Step down left.

hex Step down left.

case object HexStepDR extends HexStep

hex Step down right.

hex Step down right.

case object HexStepLt extends HexStep

Hex step left.

Hex step left.

case object HexStepNone extends HexStepOpt

An optional hex tile step of None.

An optional hex tile step of None.

sealed trait HexStepOpt extends TileStepOpt

An optional hex tile step. Can take 7 values. Represents the relative move from a hex tile to one of its six neighbours or the non move value. It can be one of the 6 HexStep values or the HexStepNone value.

An optional hex tile step. Can take 7 values. Represents the relative move from a hex tile to one of its six neighbours or the non move value. It can be one of the 6 HexStep values or the HexStepNone value.

case object HexStepRt extends HexStep

hex Step right.

hex Step right.

case object HexStepUL extends HexStep

Hex step up left.

Hex step up left.

case object HexStepUR extends HexStep

hex Step up right.

hex Step up right.

class IntGridImplicit(thisInt: Int)
case class Player(char: Char, colour: Colour) extends Show

A Player has a very simple token with a letter and colour for recognition.

A Player has a very simple token with a letter and colour for recognition.

Companion
object
object Player

Companion object for Player case class contains implicit instance for Persist.

Companion object for Player case class contains implicit instance for Persist.

Companion
class
object PlayerA extends Player
object PlayerB extends Player
object PlayerC extends Player
object PlayerD extends Player
case class SPlayer(value: Player, sc: SqCen) extends SqMem[Player]

A class identifying a Player and a hex coordinate position.

A class identifying a Player and a hex coordinate position.

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.

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

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
object SqCenArrBuff

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

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 rCenMin: Int, val rCenMax: Int, val cTileMin: Int, val cTileMax: 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 SqStepOpt

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 SqStepDiagOpt with SqStep

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

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

sealed trait SqStepDiagOpt extends SqStepOpt

An diagonal optional square tile step. Can take 5 values. Represents the relative move from a square tile to one of its diagonal 4 neighbours or the non move SqStepNone value.

An diagonal optional square tile step. Can take 5 values. Represents the relative move from a square tile to one of its diagonal 4 neighbours or the non move SqStepNone value.

case object SqStepDown extends SqStepNear

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

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

case object SqStepLeft 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 SqStepNearOpt with SqStep

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

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

sealed trait SqStepNearOpt extends SqStepOpt

An non-diagonal optional square tile step. Can take 5 values. Represents the relative move from a square tile to one of its non-diagonal 4 neighbours or the non move SqStepNone value.

An non-diagonal optional square tile step. Can take 5 values. Represents the relative move from a square tile to one of its non-diagonal 4 neighbours or the non move SqStepNone value.

case object SqStepNone extends SqStepNearOpt

An optional square tile step of None.

An optional square tile step of None.

sealed trait SqStepOpt extends TileStepOpt

An optional square tile step. Can take 9 values. Represents the relative move from a square tile to one of its eight neighbours or the non move value. It can be one of the 6 HexStep values or the HexStepNone value.

An optional square tile step. Can take 9 values. Represents the relative move from a square tile to one of its eight neighbours or the non move value. It can be one of the 6 HexStep values or the HexStepNone value.

case object SqStepRight 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]

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

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

Value members