case class Rules(gameField: GameField) extends Product with Serializable
Connects the Chess Rules to a GameField
- gameField
GameField to which the Rules are applied
- Alphabetic
- By Inheritance
- Rules
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
Value Members
- val gameField: GameField
- 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
- 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
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def validBishop(figure: Bishop, xNext: Int, yNext: Int): Boolean
- 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
- def validKing(figure: King, xNext: Int, yNext: Int): Boolean
- 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
- def validKnight(figure: Knight, xNext: Int, yNext: Int): Boolean
- 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
- def validPawn(figure: Pawn, xNext: Int, yNext: Int): Boolean
- 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
- def validQueen(figure: Queen, xNext: Int, yNext: Int): Boolean
- 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
- def validRook(figure: Rook, xNext: Int, yNext: Int): Boolean
- 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