class GameField extends GameFieldInterface
The GameField of our Chess Game, realized as a Vector of Figures
- Alphabetic
- By Inheritance
- GameField
- GameFieldInterface
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val CHECKED: Int
- Definition Classes
- GameFieldInterface
- val CHECKMATE: Int
- Definition Classes
- GameFieldInterface
- val MOVE_ILLEGAL: Int
- Definition Classes
- GameFieldInterface
- val PAWN_REACHED_END: Int
- Definition Classes
- GameFieldInterface
- val RUNNING: Int
- Definition Classes
- GameFieldInterface
- def addFigures(figures: Vector[Figure]): GameField
Adds the Figures to the gameField if the gameField does not contain them yet
Adds the Figures to the gameField if the gameField does not contain them yet
- figures
- Vector of Figures to adjust the current gameField
- returns
new gameField
- Definition Classes
- GameField → GameFieldInterface
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def cellsFreeAroundFigure(figure: Figure): List[(Int, Int)]
Checks the adjacent cells and returns a list of those who are free
Checks the adjacent cells and returns a list of those who are free
- figure
which adjacent cells should be reviewed
- returns
List of free cells
- Definition Classes
- GameField → GameFieldInterface
- def changePlayer(): Color
Changes the valid Player's color
Changes the valid Player's color
e.g. If it was White's turn before it is now Black's turn
White -> Black Black -> White
- returns
The color of the new valid Player
- Definition Classes
- GameField → GameFieldInterface
- def clear(): Boolean
Sets the valid Player to White.
Sets the valid Player to White. Clears the gameField.
- returns
true if the gameField is now empty
- Definition Classes
- GameField → GameFieldInterface
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def convertFigure(figure: Figure, toFigure: Figure): Unit
Converts one Figure to another
Converts one Figure to another
(Mostly used for converting a Pawn into Queen, Rook, Bishop or Knight after reaching the end)
- figure
to convert
- toFigure
of the wanted type
- Definition Classes
- GameField → GameFieldInterface
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def getFigure(xPos: Int, yPos: Int): Option[Figure]
Fetches the Figure at the specified position.
Fetches the Figure at the specified position.
With
getFigure(x, y).get
you are able to fetch the actual Figure. But an Exception will be thrown if the cell is empty and the call returns Option[None]! getFigure(x, y).get }}} But an Exception will be thrown if the cell is empty and the call returns Option[None]!
- xPos
value of the field
- yPos
value of the field
- returns
Option[Figure] if there is a Figure, Option[None] if the cell is empty
- Definition Classes
- GameField → GameFieldInterface
- def getFigures: Vector[Figure]
- returns
All Figures from the gameField, also those who are checked
- Definition Classes
- GameField → GameFieldInterface
- def getPawnAtEnd(): Pawn
- returns
the Pawn at the end
- Definition Classes
- GameField → GameFieldInterface
- def getPlayer: Color
- returns
Color of the Player who has to make his turn now (the valid Player)
- Definition Classes
- GameField → GameFieldInterface
- def getStatus(): Int
- returns
the gameField/ Game status
- Definition Classes
- GameField → GameFieldInterface
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def isChecked(playerCol: Color): Boolean
Inspects if the Player is checked by confirming wether any of the other Player's Figures could move to the King
Inspects if the Player is checked by confirming wether any of the other Player's Figures could move to the King
- playerCol
color of the to be examined Player
- returns
true if checked, else false
- Definition Classes
- GameField → GameFieldInterface
- def isCheckmate(playerCol: Color): Boolean
Reviews wether there is no possibility for the king to get out of check by verifying if any cells around him are free that he can move to, to get out of check
Reviews wether there is no possibility for the king to get out of check by verifying if any cells around him are free that he can move to, to get out of check
- playerCol
color of the Player to examine
- returns
true if the king can't move anymore, else false
- Definition Classes
- GameField → GameFieldInterface
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def moveTo(xNow: Int, yNow: Int, xNext: Int, yNext: Int): GameField
Moves Figure from (xNow, yNow) to (xNext, yNext).
Moves Figure from (xNow, yNow) to (xNext, yNext). If there is a (enemy) Figure at (xNext, yNext) it's going to be replaced.
- xNow
x-value the Figure stands at the moment
- yNow
y-value the Figure stands at the moment
- xNext
x-value the Figure should move to
- yNext
y-value the Figure should move to
- returns
gameField
- Definition Classes
- GameField → GameFieldInterface
- def moveToFieldAllowed(x: Int, y: Int, figure: Figure): Boolean
Confirms if you set yourself into check with this move and whether the Figure at (x, y) is a king of the other Player
Confirms if you set yourself into check with this move and whether the Figure at (x, y) is a king of the other Player
- x
value of the field
- y
value of the field
- figure
you want to move
- returns
true if you not set yourself into check and there is no king of the other Player
- Definition Classes
- GameField → GameFieldInterface
- def moveValid(xNow: Int, yNow: Int, xNext: Int, yNext: Int): Boolean
Confirms if right Player is moving.
Confirms if right Player is moving. If true validates if the move is allowed by the set rules.
- xNow
x-value the Figure stands at the moment
- yNow
y-value the Figure stands at the moment
- xNext
x-value the Figure should move to
- yNext
y-value the Figure should move to
- returns
true if the right Player is moving and if the move is valid, else false
- Definition Classes
- GameField → GameFieldInterface
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def pawnHasReachedEnd(): Boolean
Inspects if a Pawn of any color has reached the end of the field (y = 7 || y = 0)
Inspects if a Pawn of any color has reached the end of the field (y = 7 || y = 0)
- returns
true if a Pawn has reached the end, else false
- Definition Classes
- GameField → GameFieldInterface
- def setPlayer(color: Color): Color
Sets the Player who has to make his turn now (the valid Player)
Sets the Player who has to make his turn now (the valid Player)
- color
of the valid Player
- returns
the old Player's Color
- Definition Classes
- GameField → GameFieldInterface
- def setSelfIntoCheck(figure: Figure, xNext: Int, yNext: Int): Boolean
Verifies if you set yourself into check by simulating that move and inspect if any figure of the enemy checks you.
Verifies if you set yourself into check by simulating that move and inspect if any figure of the enemy checks you.
- figure
you want to move
- xNext
x-value the Figure should move to
- yNext
y-value the Figure should move to
- returns
true if a Player could check you after that move, else false
- Definition Classes
- GameField → GameFieldInterface
- def setStatus(newState: Int): Unit
Sets the status of the gameField/ ongoing Game
Sets the status of the gameField/ ongoing Game
- Definition Classes
- GameField → GameFieldInterface
- var status: Int
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString: String
- returns
String representation of the gameField
- Definition Classes
- GameField → GameFieldInterface → AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def wayToIsFreeDiagonal(xNow: Int, yNow: Int, xNext: Int, yNext: Int): Boolean
Checks if there are no Figures on the diagonal way from (xNow, yNow) to (xNext, yNext).
Checks if there are no Figures on the diagonal way from (xNow, yNow) to (xNext, yNext). Diagonal means if xNow = xNext + n and yNow = yNext + n. It will not verify if the cell at (xNext, yNext) is free!
- xNow
x-value the Figure stands at the moment
- yNow
y-value the Figure stands at the moment
- xNext
x-value the Figure should move to
- yNext
y-value the Figure should move to
- returns
true if the way is free
- Definition Classes
- GameField → GameFieldInterface
- def wayToIsFreeStraight(xNow: Int, yNow: Int, xNext: Int, yNext: Int): Boolean
Checks if there are no Figures on the straight way from (xNow, yNow) to (xNext, yNext).
Checks if there are no Figures on the straight way from (xNow, yNow) to (xNext, yNext). Straight means if xNow = xNext or yNow = yNext. It will not verify if the cell at (xNext, yNext) is free!
- xNow
x-value the Figure stands at the moment
- yNow
y-value the Figure stands at the moment
- xNext
x-value the Figure should move to
- yNext
y-value the Figure should move to
- returns
true if the way is free
- Definition Classes
- GameField → GameFieldInterface
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated