Mailbox

dicechess.engine.domain.Models$package.Mailbox
object Mailbox

A fast, flat array representation of the 64 squares on the board.

Gives O(1) piece lookup and near-instant cloning via System.arraycopy without GC allocations.

Attributes

Source
Models.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Mailbox.type

Members list

Value members

Concrete methods

def empty: Mailbox

Returns a completely empty mailbox.

Returns a completely empty mailbox.

Attributes

Source
Models.scala
inline def fromBuilder(builder: Array[Piece]): Mailbox

Creates a mailbox directly from a mutated builder array.

Creates a mailbox directly from a mutated builder array.

Attributes

Note

Mutating the builder after calling this method breaks the immutability guarantee.

Source
Models.scala

Extensions

Extensions

extension (mb: Mailbox)
inline def apply(sq: Square): Piece

Fast O(1) retrieval of the piece at sq. Returns Piece.Empty if square is unoccupied.

Fast O(1) retrieval of the piece at sq. Returns Piece.Empty if square is unoccupied.

Attributes

Source
Models.scala
inline def get(sq: Square): Option[Piece]

Optional retrieval of the piece at sq (for legacy compatibility).

Optional retrieval of the piece at sq (for legacy compatibility).

Attributes

Source
Models.scala
inline def toArray: Array[Piece]

Exposes the underlying immutable array for cloning.

Exposes the underlying immutable array for cloning.

Attributes

Source
Models.scala