MoveGenerator2D

interface MoveGenerator2D : MoveGenerator<Board2D, MoveGenerator2D, Piece2D, Coordinate2D>

Implementation of the Move Generator interface for a 2d square board.

Types

AddPromotion
Link copied to clipboard
data class AddPromotion(moveGenerators: List<MoveGenerator2D>, region: Region2D, promoPieces: List<Piece2D>, forced: Boolean) : MoveGenerator2D
A piece can be promoted to another piece in a specific region
CaptureOnly
Link copied to clipboard
data class CaptureOnly(moveGenerator: MoveGenerator2D) : MoveGenerator2D
A given move can only occur if it captures a piece
Composite
Link copied to clipboard
data class Composite(moveGenerators: List<MoveGenerator2D>) : MoveGenerator2D
A wrapper around a list of basic moves to represent composite moves
Hopper
Link copied to clipboard
data class Hopper(HV: Boolean, D: Boolean, canJumpOverSamePiece: Boolean) : MoveGenerator2D
Can move along a ray direction, but must jump over another piece
Leaper
Link copied to clipboard
data class Leaper(dx: Int, dy: Int) : MoveGenerator2D
Performs single steps to specified target squares Takes in a step-vector, which is then mirrored to give a total of up to 8 target coordinates
NoCapture
Link copied to clipboard
data class NoCapture(moveGenerator: MoveGenerator2D) : MoveGenerator2D
A given move can only occur if it does not capture a piece
Restricted
Link copied to clipboard
data class Restricted(moveGenerator: MoveGenerator2D, region: Region2D) : MoveGenerator2D
A given move can only occur when the piece starts in a specific region
RestrictedDestination
Link copied to clipboard
data class RestrictedDestination(moveGenerator: MoveGenerator2D, region: Region2D) : MoveGenerator2D
A given move can only occur if the destination is within a specific region
Skip
Link copied to clipboard
object Skip : MoveGenerator2D
Skip move: a player may decide to pass if there is no safe or desirable move
Slider
Link copied to clipboard
class Slider(H: Boolean, V: Boolean, D: Boolean, A: Boolean) : MoveGenerator2D
Moves along a ray direction until they encounter another piece or the edge of the board
Stepper
Link copied to clipboard
data class Stepper(directions: List<Direction>, step: Int, canCapture: Boolean) : MoveGenerator2D
Performs single (repeated) steps in a particular board direction

Functions

equals
Link copied to clipboard
open operator fun equals(other: Any?): Boolean
generate
Link copied to clipboard
abstract fun generate(board: Board2D, coordinate: Coordinate2D, piece: Piece2D, player: Player): List<Move<Board2D, MoveGenerator2D, Piece2D, Coordinate2D>>
Takes in the current board, the piece to be moved and its coordinate, and the player who makes the move to return all possible game moves corresponding to the given type of movement.
hashCode
Link copied to clipboard
open fun hashCode(): Int
toString
Link copied to clipboard
open fun toString(): String

Inheritors

Checkers
Link copied to clipboard
MoveGenerator2D
Link copied to clipboard
MoveGenerator2D
Link copied to clipboard
MoveGenerator2D
Link copied to clipboard
MoveGenerator2D
Link copied to clipboard
MoveGenerator2D
Link copied to clipboard
MoveGenerator2D
Link copied to clipboard
MoveGenerator2D
Link copied to clipboard
MoveGenerator2D
Link copied to clipboard
MoveGenerator2D
Link copied to clipboard
MoveGenerator2D
Link copied to clipboard
MoveGenerator2D
Link copied to clipboard