mirror of
https://github.com/lov3b/Schack.git
synced 2025-02-23 12:10:07 +01:00
Javadoc kommentarer
This commit is contained in:
parent
828cc7ed5b
commit
7fcc139f85
@ -110,6 +110,15 @@ public abstract class Piece {
|
||||
this.position = new Point(toMove);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lägger till möjliga drag i movable ifall det går
|
||||
*
|
||||
* @param pos
|
||||
* @param movable
|
||||
* @param pieces
|
||||
* @param isSelected
|
||||
* @return true ifall det inte finns fler drag att lägga till
|
||||
*/
|
||||
protected boolean addMovesIfCan(Point pos, ArrayList<Point> movable, Piece[][] pieces, boolean isSelected) {
|
||||
// Ifall vi är utanför brädet ge tillbaka false
|
||||
if (pos.x > 7 || pos.x < 0 || pos.y > 7 || pos.y < 0) {
|
||||
@ -149,6 +158,14 @@ public abstract class Piece {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulera ett drag och kolla ifall det är schack. Ifall det inte är schack
|
||||
* lägg till draget i listan movable
|
||||
*
|
||||
* @param pieces
|
||||
* @param movable Lista där allt kommer läggas till
|
||||
* @param pos
|
||||
*/
|
||||
void tryToMoveAndCheckIfCheck(Piece[][] pieces, ArrayList movable, Point pos) {
|
||||
// Kom ihåg vart vi var
|
||||
Point previousPosition = new Point(this.position);
|
||||
|
Loading…
x
Reference in New Issue
Block a user