ostrat.pGrid

package ostrat.pGrid

Type members

Classlikes

class ArrayImplicit[A](thisArray: Array[A])
final class Cood(val xi: Int, val yi: Int) extends Show2Ints

A Cood represents a 2 dimensional integer coordinate within a tile grid system. This has current been implemented for Hexs and Squares, while triangles is the third possible regular tile system. A SqGrid Cood represents either a tile centre, a tile side or a tile vertex. This is the same for a Hex Grid except that not all values are legal Cood values on a HexGrid. This system allows river and naval units to move along the tile sides. The axis are named xi and yi to distinguish them from the x and y of a Vec2. On a Hex grid there is not a simple 1 to 1 mapping between the Cood components and the Vec2 components.

A Cood represents a 2 dimensional integer coordinate within a tile grid system. This has current been implemented for Hexs and Squares, while triangles is the third possible regular tile system. A SqGrid Cood represents either a tile centre, a tile side or a tile vertex. This is the same for a Hex Grid except that not all values are legal Cood values on a HexGrid. This system allows river and naval units to move along the tile sides. The axis are named xi and yi to distinguish them from the x and y of a Vec2. On a Hex grid there is not a simple 1 to 1 mapping between the Cood components and the Vec2 components.

Companion
object
object Cood
Companion
class
final class CoodBuff(val buffer: ArrayBuffer[Int]) extends AnyVal with Int2sBuffer[Cood, Coods]
case class CoodLine(x1: Int, y1: Int, x2: Int, y2: Int) extends Int4Elem

A 2d line defined by its start and end Tile Cood.

A 2d line defined by its start and end Tile Cood.

Companion
object
object CoodLine
Companion
class
final class CoodLines(val arrayUnsafe: Array[Int]) extends AnyVal with Int4sArr[CoodLine]

An Array[Int] based collection for CoodLines.

An Array[Int] based collection for CoodLines.

Companion
object
final class CoodLinesBuff(val buffer: ArrayBuffer[Int]) extends AnyVal with Int4sBuffer[CoodLine, CoodLines]
trait CoodMover
object CoodNew
final class Coods(val arrayUnsafe: Array[Int]) extends AnyVal with Int2sArr[Cood]

An array[Int] based collection for Cood. To be replaced by Roords.

An array[Int] based collection for Cood. To be replaced by Roords.

Companion
object
object Coods extends Int2sArrCompanion[Cood, Coods]
Companion
class
trait EGridOld extends HexGridIrrOld

In a simple Grid the only GridElems are Tiles. In a complex grid, there are values for tiles and tile sides. For programmatic purposes it is vital that GridElem contains its grid coordinates, although at a logical level a tile does not need to know its position within the tile grid. It needs this information so it can communicate with its grid.

In a simple Grid the only GridElems are Tiles. In a complex grid, there are values for tiles and tile sides. For programmatic purposes it is vital that GridElem contains its grid coordinates, although at a logical level a tile does not need to know its position within the tile grid. It needs this information so it can communicate with its grid.

class GridSlateScaleExtension[T](value: T)(implicit grid: TileGridOld, evSlate: Slate[T], evScale: Scale[T])
class GridTransSimExtension[T](value: T)(implicit grid: TileGridOld, ev: TransSim[T])
object HCen extends HexDirn
object HDownLeft extends HexDirn
object HDownRight extends HexDirn
object HLeft extends HexDirn
object HRight extends HexDirn
case class HSideCood(x: Int, y: Int)

I've kept this file because some of the code may be useful

I've kept this file because some of the code may be useful

class HTStep(yIn: Int, cIn: Int) extends HTStepOpt

A Hex tile Step can take 6 values

A Hex tile Step can take 6 values

case object HTStepNone extends HTStepOpt
class HTStepOpt(val y: Int, c: Int)

An optional hex tile step. 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 HTStep values or the HTStepNone value.

An optional hex tile step. 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 HTStep values or the HTStepNone value.

case class HTileAndStep(y1: Int, c1: Int, step: HTStep)
object HUpLeft extends HexDirn
object HUpRight extends HexDirn
case object HVOffDL extends HVOffDirn
case object HVOffDR extends HVOffDirn
sealed class HVOffDirn(val y: Int, val c: Int)

yDiv4Rem0 Up, DR, DL or yDiv4Rem2 UR, Dn, UL

yDiv4Rem0 Up, DR, DL or yDiv4Rem2 UR, Dn, UL

case object HVOffDown extends HVOffDirn
case object HVOffUL extends HVOffDirn
case object HVOffUR extends HVOffDirn
case object HVOffUp extends HVOffDirn
class HexDirn(x: Int, y: Int)
Companion
object
object HexDirn
Companion
class
object HexGet
abstract class HexGridAncient[TileT <: TileAncient, SideT <: TileSideAncient](val xTileMin: Int, val xTileMax: Int, val yTileMin: Int, val yTileMax: Int, val turnNum: Int)(implicit val evTile: ClassTag[TileT], val evSide: ClassTag[SideT]) extends TileGridAncient[TileT, SideT]

To be deprecated. A Hex tile own the right sides, upRight, Right and DownRight. It owns the Up, UpRight and DownRight Vertices numbers 0, 1 and 2.

To be deprecated. A Hex tile own the right sides, upRight, Right and DownRight. It owns the Up, UpRight and DownRight Vertices numbers 0, 1 and 2.

Companion
object
Companion
class
abstract class HexGridIrrAncient[TileT <: TileAncient, SideT <: TileSideAncient](val rowBounds: Array[Int], xTileMin: Int, xTileMax: Int, yTileMin: Int, yTileMax: Int, turnNum: Int)(implicit evTile: ClassTag[TileT], evSide: ClassTag[SideT]) extends HexGridAncient[TileT, SideT]
class HexGridIrrOld(val yTileMin: Int, val tileRowsStartEnd: Array[Int]) extends HexGridOld

This grid is irregular in the length of the Hex rows. The (0) value gives yTileMin. There are 2 more values for row. Each row from lowest to highest has two values the xMin for the row and the index into a data array for the first tile of the grid row. *

This grid is irregular in the length of the Hex rows. The (0) value gives yTileMin. There are 2 more values for row. Each row from lowest to highest has two values the xMin for the row and the index into a data array for the first tile of the grid 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.

trait HexGridOld extends TileGridOld

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.

Companion
object
object HexGridOld
Companion
class
class HexGridRegOld(val yTileMin: Int, val yTileMax: Int, val cTileMin: Int, val cTileMax: Int) extends HexGridOld
Companion
object
Companion
class
case class HexTile(y: Int, c: Int) extends Tile
class IntGridImplicit(thisInt: Int)
case class Node(tile: Roord, var gCost: Int, var hCost: Int, var parent: OptRef[Node])
trait OfGridElem[TileT <: TileAncient, SideT <: TileSideAncient, GridT <: TileGridAncient[TileT, SideT]]

To be removed. Although including the cood could be considered to break the principle of encapsulation, A tile should not need to know where it is in a grid. I think it is necessary. Although the cood is determined by its position in the array there is just no good way for this data to be recovered by the Grid for random access. I think also it might be better to change to a var.

To be removed. Although including the cood could be considered to break the principle of encapsulation, A tile should not need to know where it is in a grid. I think it is necessary. Although the cood is determined by its position in the array there is just no good way for this data to be recovered by the Grid for random access. I think also it might be better to change to a var.

trait OfHex[TileT <: TileAncient, SideT <: TileSideAncient, GridT <: HexGridAncient[TileT, SideT]] extends OfTile[TileT, SideT, GridT]
Companion
object
object OfHex
Companion
class
trait OfHexSide[TileT <: TileAncient, SideT <: TileSideAncient, GridT <: HexGridAncient[TileT, SideT]] extends OfSide[TileT, SideT, GridT]
trait OfSide[TileT <: TileAncient, SideT <: TileSideAncient, GridT <: TileGridAncient[TileT, SideT]] extends OfGridElem[TileT, SideT, GridT]
trait OfTile[TileT <: TileAncient, SideT <: TileSideAncient, GridT <: TileGridAncient[TileT, SideT]] extends OfGridElem[TileT, SideT, GridT]

I am happy with the fundamental concept behind the OfTile traits, documentation later

I am happy with the fundamental concept behind the OfTile traits, documentation later

final class Roord extends AnyVal with Int2Elem

A Roord Row-ordinate represents a 2 dimensional integer coordinate within a tile grid system. The row or y value comes first. This is different to a Vec2 or Vec3 where the y vlue comes 2nd after the x valu. This has current been implemented for Hexs and Squares, while triangles is the third possible regular tile system. A SqGrid Cood represents either a tile centre, a tile side or a tile vertex. This is the same for a Hex Grid except that not all values are legal Cood values on a HexGrid. This system allows river and naval units to move along the tile sides. The axis are named y and c to distinguish them from the x and y of a Vec2. On a Hex grid there is not a simple 1 to 1 mapping between the Cood components and the Vec2 components.

A Roord Row-ordinate represents a 2 dimensional integer coordinate within a tile grid system. The row or y value comes first. This is different to a Vec2 or Vec3 where the y vlue comes 2nd after the x valu. This has current been implemented for Hexs and Squares, while triangles is the third possible regular tile system. A SqGrid Cood represents either a tile centre, a tile side or a tile vertex. This is the same for a Hex Grid except that not all values are legal Cood values on a HexGrid. This system allows river and naval units to move along the tile sides. The axis are named y and c to distinguish them from the x and y of a Vec2. On a Hex grid there is not a simple 1 to 1 mapping between the Cood components and the Vec2 components.

Companion
object
object Roord
Companion
class
final class RoordBuff(val buffer: ArrayBuffer[Int]) extends AnyVal with Int2sBuffer[Roord, Roords]
case class RoordLine(y1: Int, c1: Int, y2: Int, c2: Int) extends Int4Elem

A 2d line defined by its start and end TileGrid Roord.

A 2d line defined by its start and end TileGrid Roord.

Companion
object
object RoordLine
Companion
class
final class RoordLines(val arrayUnsafe: Array[Int]) extends AnyVal with Int4sArr[RoordLine]

An Array[Int] based collection for RoordLines.

An Array[Int] based collection for RoordLines.

Companion
object
final class RoordLinesBuff(val buffer: ArrayBuffer[Int]) extends AnyVal with Int4sBuffer[RoordLine, RoordLines]
case class RoordOff(yV: Int, cV: Int, dirn: HVOffDirn, tenths: Int)

A deci-Roordinate. Divides the line between 2 Roords into graduations of ten. Defines the point a certain number of tenths toward the second Roord.

A deci-Roordinate. Divides the line between 2 Roords into graduations of ten. Defines the point a certain number of tenths toward the second Roord.

Companion
object
object RoordOff
Companion
class
final class Roords(val arrayUnsafe: Array[Int]) extends AnyVal with Int2sArr[Roord]

An array[Int] based collection for Roord.

An array[Int] based collection for Roord.

Companion
object
Companion
class
class RowMulti[TileT <: AnyRef](val y: Int, val xStart: Int, val multis: RefsMulti[TileT])
Companion
object
object RowMulti
Companion
class
object SFaceDL extends SqFace
object SFaceDR extends SqFace
object SFaceDn extends SqFace
object SFaceLt extends SqFace
object SFaceRt extends SqFace
object SFaceUL extends SqFace
object SFaceUR extends SqFace
object SFaceUp extends SqFace
case class SideBareAncient(x: Int, y: Int) extends TileSideAncient
Companion
object
Companion
class
final class SideBooleans(val unsafeArr: Array[Boolean]) extends AnyVal
final class SqCoodDep(val x: Int, val y: Int)

I've kept this file because some code might be useful

I've kept this file because some code might be useful

sealed class SqFace(val ordNum: Int, val angle: AngleVec, val xTile: Int, val yTile: Int)
Companion
object
object SqFace
Companion
class
case class SqTile(y: Int, c: Int) extends Tile
class SquareGridOld(yTileMin: Int, yTileMax: Int, cTileMin: Int, cTileMax: Int) extends SquareGridSimpleOld with TileGridOld

Currently all SquareGrids are regular.

Currently all SquareGrids are regular.

Companion
object
Companion
class
class SquareGridSimpleOld(val yTileMin: Int, val yTileMax: Int, val cTileMin: Int, val cTileMax: Int) extends TileGridOld

Currently all SquareGrids are regular.

Currently all SquareGrids are regular.

Companion
object
Companion
class
trait Tile
case class TileBareAncient(x: Int, y: Int) extends TileAncient
final class TileBooleans(val unsafeArr: Array[Boolean]) extends AnyVal

An immutable Arr of Boolean Tile data for a specific TileGrid. This is specialised for Boolean. The tileGrid can map the Roord of the Tile to the index of the Arr. Hence most methods take an implicit TIleGrid parameter.

An immutable Arr of Boolean Tile data for a specific TileGrid. This is specialised for Boolean. The tileGrid can map the Roord of the Tile to the index of the Arr. Hence most methods take an implicit TIleGrid parameter.

trait TileGridAncient[TileT <: TileAncient, SideT <: TileSideAncient]

A Tile grid that contains both values for the tiles and the tile boundaries or sides. Rivers, straits, walls, doors, windows ditches and fortifications are examples of values commonly assigned to tile sides.

A Tile grid that contains both values for the tiles and the tile boundaries or sides. Rivers, straits, walls, doors, windows ditches and fortifications are examples of values commonly assigned to tile sides.

A tileGrid is a collection of tiles, either hexs or squares. This is a fundamental trait. It is a specific case of a tiled area. I have reached the conclusion that the general case of completely irregular tiling, while interesting mathematically and useful for say representing a historical game like "Risk", has insufficient utility for the representations we want today. Tile rids can however be fully regular or partly irregular such as the grids for covering the Earth's surface. Grids can be simple just consisting of values for the tiles or complex containing values for the tiles and the tile sides. Rivers, straits, walls, ditches are examples of values commonly assigned to tile sides.

It is stored in an underlying array. It consists of a sequence of contiguous rows of tiles. Each row of tiles is itself contiguous, There are no breaks between the first tile of the row and the last tile of the row although a row can consist of a single tile. Every row shares at least one tile side with the row above and below. The grid includes all the sides of the tiles including the sides on the outer edges of the grid. This means to link two grids requires a Grid Bridge class.

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 TileMem[A]
case class TileRow[T <: AnyRef](yRow: Int, xStart: Int, yStart: Int, values: Arr[Multiple[T]])
Companion
object
object TileRow
Companion
class
class TilesArr[A <: AnyRef](val unsafeArr: Array[A])

An immutable Arr of Tile data for a specific TileGrid. This is specialised for AnyRef types The tileGrid can map the Roord of the Tile to the index of the Arr. Hence most methods take an implicit TIleGrid parameter.

An immutable Arr of Tile data for a specific TileGrid. This is specialised for AnyRef types The tileGrid can map the Roord of the Tile to the index of the Arr. Hence most methods take an implicit TIleGrid parameter.

Companion
object
object TilesArr
Companion
class
final class TilesArrOpt[A <: AnyRef](val unsafeArr: Array[A]) extends AnyVal

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

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

class TilesListImplicit[A](thisRefs: TilesArr[List[A]])

Not sure about the use of List in this class.

Not sure about the use of List in this class.

final class VertInts(val unsafeArr: Array[Int]) extends AnyVal

Value members

Concrete methods

def hexSidesHorr(y: Int, cStart: Int, cEnd: Int): Roords

Gives a Coods Seq of Cood along a horizontal line

Gives a Coods Seq of Cood along a horizontal line

Deprecated methods

@deprecated
def hexSidesHorrOld(y: Int, xStart: Int, xEnd: Int): Coods

Gives a Coods Seq of Cood along a horisonatal line

Gives a Coods Seq of Cood along a horisonatal line

Deprecated
@deprecated
def rectHCoods(xDim: Int, yDim: Int, xOff: Int, yOff: Int): Set[Cood]

Not sure about this method

Not sure about this method

Deprecated

Concrete fields

val Cood00: Cood