Packages

case class Rules(gameField: GameField) extends Product with Serializable

Connects the Chess Rules to a GameField

gameField

GameField to which the Rules are applied

Linear Supertypes
Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Rules
  2. Serializable
  3. Product
  4. Equals
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Rules(gameField: GameField)

    gameField

    GameField to which the Rules are applied

Value Members

  1. val gameField: GameField
  2. def moveValidFigure(xNow: Int, yNow: Int, xNext: Int, yNext: Int): Boolean

    Calls specific Rules for the Figure in question

    Calls specific Rules for the Figure in question

    xNow

    x-Axis Position on the GameField

    yNow

    y-Axis Position on the GameField

    xNext

    x-Axis Position of the destination

    yNext

    y-Axis Position of the destination

    returns

    true if move valid, otherwise false

  3. def moveValidWithoutKingCheck(xNow: Int, yNow: Int, xNext: Int, yNext: Int): Boolean

    Determines wether the specific Move results in Check.

    Determines wether the specific Move results in Check.

    In contradiciton to the methode name it inspects the move being valid to any position. But if the goal is to determine wether a King could possibly be checked the method is called like this:

    validPawnWithoutKingCheck(figure, King.xPos, King.yPos)
    xNow

    x-Axis Position on the GameField

    yNow

    y-Axis Position on the GameField

    xNext

    x-Axis Position of the destination

    yNext

    y-Axis Position of the destination

    returns

    true if King isn't checked, otherwise false

  4. def productElementNames: Iterator[String]
    Definition Classes
    Product
  5. def validBishop(figure: Bishop, xNext: Int, yNext: Int): Boolean

    See validBishopWithoutKingCheck

  6. def validBishopWithoutKingCheck(figure: Bishop, xNext: Int, yNext: Int): Boolean

    Verifies if a Bishop is moving valid.

    Verifies if a Bishop is moving valid.

    A Bishop can move any number of cells diagonal (as long as there is no allied Piece in the way or an enemy Piece is hit).

    See also moveValidWithoutKingCheck

    figure

    The to be moved Bishop

    xNext

    x-Axis Position of the destination

    yNext

    y-Axis Position of the destination

    returns

    true if move valid, otherwise false

  7. def validKing(figure: King, xNext: Int, yNext: Int): Boolean

    See validKingWithoutKingCheck

  8. def validKingWithoutKingCheck(figure: King, xNext: Int, yNext: Int): Boolean

    Verifies if a King is moving valid.

    Verifies if a King is moving valid.

    A King can move 1 cell diagonal or straight (as long as there is no allied Piece in the way or an enemy Piece is hit).

    See also moveValidWithoutKingCheck

    figure

    The to be moved King

    xNext

    x-Axis Position of the destination

    yNext

    y-Axis Position of the destination

    returns

    true if move valid, otherwise false

  9. def validKnight(figure: Knight, xNext: Int, yNext: Int): Boolean

    See validKnightWithoutKingCheck

  10. def validKnightWithoutKingCheck(figure: Knight, xNext: Int, yNext: Int): Boolean

    Verifies if a Knight is moving valid.

    Verifies if a Knight is moving valid.

    A Knight can move two cells horizontally then one cell vertically or two cells vertically then one horizontally.

    It is not blocked by other Pieces, the Knight jumps to the new location.

    See also moveValidWithoutKingCheck

    figure

    The to be moved Knight

    xNext

    x-Axis Position of the destination

    yNext

    y-Axis Position of the destination

    returns

    true if move valid, otherwise false

  11. def validPawn(figure: Pawn, xNext: Int, yNext: Int): Boolean

    See validPawnWithoutKingCheck

  12. def validPawnWithoutKingCheck(figure: Pawn, xNext: Int, yNext: Int): Boolean

    Verifies if a Pawn is moving valid.

    Verifies if a Pawn is moving valid.

    A Pawn can move 2 cells upward if it hasn't been moved yet, or 1 cell if it has.

    It can only move 1 cell in the diagonal if there is an enemy Piece.

    Pawns can never move backward.

    See also moveValidWithoutKingCheck

    figure

    The to be moved Pawn

    xNext

    x-Axis Position of the destination

    yNext

    y-Axis Position of the destination

    returns

    true if move valid, otherwise false

  13. def validQueen(figure: Queen, xNext: Int, yNext: Int): Boolean

    See validQueenWithoutKingCheck

  14. def validQueenWithoutKingCheck(figure: Queen, xNext: Int, yNext: Int): Boolean

    Verifies if a Queen is moving valid.

    Verifies if a Queen is moving valid.

    A Queen can move any number of cells diagonal or straight (as long as there is no allied Piece in the way or an enemy Piece is hit).

    See also moveValidWithoutKingCheck

    figure

    The to be moved Queen

    xNext

    x-Axis Position of the destination

    yNext

    y-Axis Position of the destination

    returns

    true if move valid, otherwise false

  15. def validRook(figure: Rook, xNext: Int, yNext: Int): Boolean

    See validRookWithoutKingCheck

  16. def validRookWithoutKingCheck(figure: Rook, xNext: Int, yNext: Int): Boolean

    Verifies if a Rook is moving valid.

    Verifies if a Rook is moving valid.

    A Rook can move any number of cells straight (as long as there is no allied Piece in the way or an enemy Piece is hit). See also moveValidWithoutKingCheck

    figure

    The to be moved Rook

    xNext

    x-Axis Position of the destination

    yNext

    y-Axis Position of the destination

    returns

    true if move valid, otherwise false