Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
chess
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
9611046
chess
Commits
06a3cff9
Commit
06a3cff9
authored
May 18, 2019
by
9611046
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
King position corected
parent
05d5172b
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
51 additions
and
28 deletions
+51
-28
Main.java
src/game/Main.java
+6
-4
Square.java
src/game/Square.java
+11
-3
Bishop.java
src/pieces/Bishop.java
+4
-4
Knight.java
src/pieces/Knight.java
+1
-1
Pawn.java
src/pieces/Pawn.java
+4
-4
Piece.java
src/pieces/Piece.java
+11
-0
Queen.java
src/pieces/Queen.java
+10
-8
Rook.java
src/pieces/Rook.java
+4
-4
No files found.
src/game/Main.java
View file @
06a3cff9
...
@@ -173,19 +173,21 @@ private Main() {
...
@@ -173,19 +173,21 @@ private Main() {
}
}
else
if
(
i
==
0
&&
j
==
3
)
{
else
if
(
i
==
0
&&
j
==
3
)
{
//piece = bk;
//piece = bk;
chessBoardSquares
[
i
][
j
].
setPiece
(
b
k
);
chessBoardSquares
[
i
][
j
].
setPiece
(
b
q
);
}
}
else
if
(
i
==
0
&&
j
==
4
)
{
else
if
(
i
==
0
&&
j
==
4
)
{
//piece = bq;
//piece = bq;
chessBoardSquares
[
i
][
j
].
setPiece
(
bq
);
chessBoardSquares
[
i
][
j
].
setPiece
(
bk
);
}
}
else
if
(
i
==
7
&&
j
==
3
)
{
else
if
(
i
==
7
&&
j
==
3
)
{
//piece = wk;
//piece = wk;
chessBoardSquares
[
i
][
j
].
setPiece
(
w
k
);
chessBoardSquares
[
i
][
j
].
setPiece
(
w
q
);
}
}
else
if
(
i
==
7
&&
j
==
4
)
{
else
if
(
i
==
7
&&
j
==
4
)
{
//piece = wq;
//piece = wq;
chessBoardSquares
[
i
][
j
].
setPiece
(
wq
);
chessBoardSquares
[
i
][
j
].
setPiece
(
wk
);
}
}
else
if
(
i
==
1
)
{
else
if
(
i
==
1
)
{
// piece = bp[j];
// piece = bp[j];
...
...
src/game/Square.java
View file @
06a3cff9
...
@@ -28,6 +28,12 @@ public class Square extends JButton {
...
@@ -28,6 +28,12 @@ public class Square extends JButton {
this
.
y
=
y
;
this
.
y
=
y
;
}
public
Square
(
int
x
,
int
y
,
Piece
piece
){
this
.
x
=
x
;
this
.
y
=
y
;
this
.
piece
=
piece
;
}
}
/**
/**
...
@@ -37,9 +43,11 @@ public class Square extends JButton {
...
@@ -37,9 +43,11 @@ public class Square extends JButton {
public
void
setPiece
(
Piece
piece
)
{
public
void
setPiece
(
Piece
piece
)
{
this
.
piece
=
piece
;
this
.
piece
=
piece
;
hasPiece
=
true
;
hasPiece
=
true
;
ImageIcon
img
=
new
ImageIcon
(
this
.
getClass
().
getResource
(
piece
.
getImage
()));
// ImageIcon img=new ImageIcon(this.getClass().getResource(piece.getImage()));
image
=
new
JLabel
(
img
);
// image=new JLabel(img);
this
.
add
(
image
);
// JLabel imgLabel = new JLabel(new ImageIcon(piece.getImage()));
this
.
add
(
new
JLabel
(
new
ImageIcon
(
piece
.
getImage
())));
// this.add(image);
}
}
/**
/**
...
...
src/pieces/Bishop.java
View file @
06a3cff9
...
@@ -23,7 +23,7 @@ public class Bishop extends Piece {
...
@@ -23,7 +23,7 @@ public class Bishop extends Piece {
{
{
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
}
}
else
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
().
getPieceColor
()
==
this
.
getPieceColor
(
))
else
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
().
getPieceColor
()
.
equals
(
this
.
getPieceColor
()
))
break
;
break
;
else
else
{
{
...
@@ -38,7 +38,7 @@ public class Bishop extends Piece {
...
@@ -38,7 +38,7 @@ public class Bishop extends Piece {
{
{
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
()==
null
)
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
()==
null
)
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
else
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
().
getPieceColor
()
==
this
.
getPieceColor
(
))
else
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
().
getPieceColor
()
.
equals
(
this
.
getPieceColor
()
))
break
;
break
;
else
else
{
{
...
@@ -53,7 +53,7 @@ public class Bishop extends Piece {
...
@@ -53,7 +53,7 @@ public class Bishop extends Piece {
{
{
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
()==
null
)
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
()==
null
)
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
else
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
().
getPieceColor
()
==
this
.
getPieceColor
(
))
else
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
().
getPieceColor
()
.
equals
(
this
.
getPieceColor
()
))
break
;
break
;
else
else
{
{
...
@@ -68,7 +68,7 @@ public class Bishop extends Piece {
...
@@ -68,7 +68,7 @@ public class Bishop extends Piece {
{
{
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
()==
null
)
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
()==
null
)
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
else
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
().
getPieceColor
()
==
this
.
getPieceColor
(
))
else
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
().
getPieceColor
()
.
equals
(
this
.
getPieceColor
()
))
break
;
break
;
else
else
{
{
...
...
src/pieces/Knight.java
View file @
06a3cff9
...
@@ -16,7 +16,7 @@ public class Knight extends Piece {
...
@@ -16,7 +16,7 @@ public class Knight extends Piece {
int
posy
[]
=
{
y
-
2
,
y
+
2
,
y
-
1
,
y
+
1
,
y
-
2
,
y
+
2
,
y
-
1
,
y
+
1
};
int
posy
[]
=
{
y
-
2
,
y
+
2
,
y
-
1
,
y
+
1
,
y
-
2
,
y
+
2
,
y
-
1
,
y
+
1
};
for
(
int
i
=
0
;
i
<
8
;
i
++)
for
(
int
i
=
0
;
i
<
8
;
i
++)
if
((
posx
[
i
]
>=
0
&&
posx
[
i
]
<
8
&&
posy
[
i
]
>=
0
&&
posy
[
i
]
<
8
))
if
((
posx
[
i
]
>=
0
&&
posx
[
i
]
<
8
&&
posy
[
i
]
>=
0
&&
posy
[
i
]
<
8
))
if
((
boardSquares
[
posx
[
i
]][
posy
[
i
]].
getPiece
()
==
null
||
boardSquares
[
posx
[
i
]][
posy
[
i
]].
getPiece
().
getPieceColor
()
!=
this
.
getPieceColor
(
)))
{
if
((
boardSquares
[
posx
[
i
]][
posy
[
i
]].
getPiece
()
==
null
||
!
boardSquares
[
posx
[
i
]][
posy
[
i
]].
getPiece
().
getPieceColor
().
equals
(
this
.
getPieceColor
()
)))
{
possibleSquares
.
add
(
boardSquares
[
posx
[
i
]][
posy
[
i
]]);
possibleSquares
.
add
(
boardSquares
[
posx
[
i
]][
posy
[
i
]]);
}
}
return
possibleSquares
;
return
possibleSquares
;
...
...
src/pieces/Pawn.java
View file @
06a3cff9
...
@@ -26,9 +26,9 @@ public class Pawn extends Piece {
...
@@ -26,9 +26,9 @@ public class Pawn extends Piece {
possibleSquares
.
add
(
boardSquares
[
4
][
y
]);
possibleSquares
.
add
(
boardSquares
[
4
][
y
]);
}
}
}
}
if
((
y
>
0
)
&&
(
boardSquares
[
x
-
1
][
y
-
1
].
getPiece
()
!=
null
)
&&
(
boardSquares
[
x
-
1
][
y
-
1
].
getPiece
().
getPieceColor
()
!=
this
.
getPieceColor
(
)))
if
((
y
>
0
)
&&
(
boardSquares
[
x
-
1
][
y
-
1
].
getPiece
()
!=
null
)
&&
(
!
boardSquares
[
x
-
1
][
y
-
1
].
getPiece
().
getPieceColor
().
equals
(
this
.
getPieceColor
()
)))
possibleSquares
.
add
(
boardSquares
[
x
-
1
][
y
-
1
]);
possibleSquares
.
add
(
boardSquares
[
x
-
1
][
y
-
1
]);
if
((
y
<
7
)
&&
(
boardSquares
[
x
-
1
][
y
+
1
].
getPiece
()
!=
null
)
&&
(
boardSquares
[
x
-
1
][
y
+
1
].
getPiece
().
getPieceColor
()
!=
this
.
getPieceColor
(
)))
if
((
y
<
7
)
&&
(
boardSquares
[
x
-
1
][
y
+
1
].
getPiece
()
!=
null
)
&&
(
!
boardSquares
[
x
-
1
][
y
+
1
].
getPiece
().
getPieceColor
().
equals
(
this
.
getPieceColor
()
)))
possibleSquares
.
add
(
boardSquares
[
x
-
1
][
y
+
1
]);
possibleSquares
.
add
(
boardSquares
[
x
-
1
][
y
+
1
]);
}
}
else
if
(
getPieceColor
().
equals
(
"b"
))
{
else
if
(
getPieceColor
().
equals
(
"b"
))
{
...
@@ -41,9 +41,9 @@ public class Pawn extends Piece {
...
@@ -41,9 +41,9 @@ public class Pawn extends Piece {
possibleSquares
.
add
(
boardSquares
[
3
][
y
]);
possibleSquares
.
add
(
boardSquares
[
3
][
y
]);
}
}
}
}
if
((
y
>
0
)
&&
(
boardSquares
[
x
+
1
][
y
-
1
].
getPiece
()
!=
null
)
&&
(
boardSquares
[
x
+
1
][
y
-
1
].
getPiece
().
getPieceColor
()
!=
this
.
getPieceColor
(
)))
if
((
y
>
0
)
&&
(
boardSquares
[
x
+
1
][
y
-
1
].
getPiece
()
!=
null
)
&&
(
!
boardSquares
[
x
+
1
][
y
-
1
].
getPiece
().
getPieceColor
().
equals
(
this
.
getPieceColor
()
)))
possibleSquares
.
add
(
boardSquares
[
x
+
1
][
y
-
1
]);
possibleSquares
.
add
(
boardSquares
[
x
+
1
][
y
-
1
]);
if
((
y
<
7
)
&&
(
boardSquares
[
x
+
1
][
y
+
1
].
getPiece
()
!=
null
)
&&
(
boardSquares
[
x
+
1
][
y
+
1
].
getPiece
().
getPieceColor
()
!=
this
.
getPieceColor
(
)))
if
((
y
<
7
)
&&
(
boardSquares
[
x
+
1
][
y
+
1
].
getPiece
()
!=
null
)
&&
(
!
boardSquares
[
x
+
1
][
y
+
1
].
getPiece
().
getPieceColor
().
equals
(
this
.
getPieceColor
()
)))
possibleSquares
.
add
(
boardSquares
[
x
+
1
][
y
+
1
]);
possibleSquares
.
add
(
boardSquares
[
x
+
1
][
y
+
1
]);
}
}
...
...
src/pieces/Piece.java
View file @
06a3cff9
package
pieces
;
package
pieces
;
import
game.Square
;
import
java.util.ArrayList
;
/**
/**
* Piece is an abstract class which means that it cannot be instantiated
* Piece is an abstract class which means that it cannot be instantiated
*Rook, Knight, Queen, King and Pawn are subclasses of Piece
*Rook, Knight, Queen, King and Pawn are subclasses of Piece
...
@@ -10,6 +14,13 @@ private String pieceColor;
...
@@ -10,6 +14,13 @@ private String pieceColor;
private
String
imagePath
;
private
String
imagePath
;
//possibleSquares is protected in Piece class therefore subclasses have access to it
//for all subclasses used one arrayList and before using it in each class content will be cleared
protected
ArrayList
<
Square
>
possibleSquares
=
new
ArrayList
<>();
public
void
setImage
(
String
image
)
{
public
void
setImage
(
String
image
)
{
imagePath
=
image
;
imagePath
=
image
;
}
}
...
...
src/pieces/Queen.java
View file @
06a3cff9
...
@@ -5,6 +5,7 @@ import game.Square;
...
@@ -5,6 +5,7 @@ import game.Square;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
public
class
Queen
extends
Piece
{
public
class
Queen
extends
Piece
{
public
Queen
(
String
ID
,
String
imagePath
,
String
color
){
public
Queen
(
String
ID
,
String
imagePath
,
String
color
){
setPieceId
(
ID
);
setPieceId
(
ID
);
setImage
(
imagePath
);
setImage
(
imagePath
);
...
@@ -17,7 +18,7 @@ public class Queen extends Piece {
...
@@ -17,7 +18,7 @@ public class Queen extends Piece {
while
(
tempx
>=
0
)
{
while
(
tempx
>=
0
)
{
if
(
boardSquares
[
tempx
][
y
].
getPiece
()
==
null
)
if
(
boardSquares
[
tempx
][
y
].
getPiece
()
==
null
)
possibleSquares
.
add
(
boardSquares
[
tempx
][
y
]);
possibleSquares
.
add
(
boardSquares
[
tempx
][
y
]);
else
if
(
boardSquares
[
tempx
][
y
].
getPiece
().
getPieceColor
()
==
this
.
getPieceColor
(
))
else
if
(
boardSquares
[
tempx
][
y
].
getPiece
().
getPieceColor
()
.
equals
(
this
.
getPieceColor
()
))
break
;
break
;
else
{
else
{
possibleSquares
.
add
(
boardSquares
[
tempx
][
y
]);
possibleSquares
.
add
(
boardSquares
[
tempx
][
y
]);
...
@@ -30,7 +31,7 @@ public class Queen extends Piece {
...
@@ -30,7 +31,7 @@ public class Queen extends Piece {
while
(
tempx
<
8
)
{
while
(
tempx
<
8
)
{
if
(
boardSquares
[
tempx
][
y
].
getPiece
()
==
null
)
if
(
boardSquares
[
tempx
][
y
].
getPiece
()
==
null
)
possibleSquares
.
add
(
boardSquares
[
tempx
][
y
]);
possibleSquares
.
add
(
boardSquares
[
tempx
][
y
]);
else
if
(
boardSquares
[
tempx
][
y
].
getPiece
().
getPieceColor
()
==
this
.
getPieceColor
(
))
else
if
(
boardSquares
[
tempx
][
y
].
getPiece
().
getPieceColor
()
.
equals
(
this
.
getPieceColor
()
))
break
;
break
;
else
{
else
{
possibleSquares
.
add
(
boardSquares
[
tempx
][
y
]);
possibleSquares
.
add
(
boardSquares
[
tempx
][
y
]);
...
@@ -45,7 +46,7 @@ public class Queen extends Piece {
...
@@ -45,7 +46,7 @@ public class Queen extends Piece {
while
(
tempy
>=
0
)
{
while
(
tempy
>=
0
)
{
if
(
boardSquares
[
x
][
tempy
].
getPiece
()
==
null
)
if
(
boardSquares
[
x
][
tempy
].
getPiece
()
==
null
)
possibleSquares
.
add
(
boardSquares
[
x
][
tempy
]);
possibleSquares
.
add
(
boardSquares
[
x
][
tempy
]);
else
if
(
boardSquares
[
x
][
tempy
].
getPiece
().
getPieceColor
()
==
this
.
getPieceColor
(
))
else
if
(
boardSquares
[
x
][
tempy
].
getPiece
().
getPieceColor
()
.
equals
(
this
.
getPieceColor
()
))
break
;
break
;
else
{
else
{
possibleSquares
.
add
(
boardSquares
[
x
][
tempy
]);
possibleSquares
.
add
(
boardSquares
[
x
][
tempy
]);
...
@@ -57,7 +58,7 @@ public class Queen extends Piece {
...
@@ -57,7 +58,7 @@ public class Queen extends Piece {
while
(
tempy
<
8
)
{
while
(
tempy
<
8
)
{
if
(
boardSquares
[
x
][
tempy
].
getPiece
()
==
null
)
if
(
boardSquares
[
x
][
tempy
].
getPiece
()
==
null
)
possibleSquares
.
add
(
boardSquares
[
x
][
tempy
]);
possibleSquares
.
add
(
boardSquares
[
x
][
tempy
]);
else
if
(
boardSquares
[
x
][
tempy
].
getPiece
().
getPieceColor
()
==
this
.
getPieceColor
(
))
else
if
(
boardSquares
[
x
][
tempy
].
getPiece
().
getPieceColor
()
.
equals
(
this
.
getPieceColor
()
))
break
;
break
;
else
{
else
{
possibleSquares
.
add
(
boardSquares
[
x
][
tempy
]);
possibleSquares
.
add
(
boardSquares
[
x
][
tempy
]);
...
@@ -72,7 +73,7 @@ public class Queen extends Piece {
...
@@ -72,7 +73,7 @@ public class Queen extends Piece {
while
(
tempx
<
8
&&
tempy
>=
0
)
{
while
(
tempx
<
8
&&
tempy
>=
0
)
{
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
()
==
null
)
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
()
==
null
)
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
else
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
().
getPieceColor
()
==
this
.
getPieceColor
(
))
else
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
().
getPieceColor
()
.
equals
(
this
.
getPieceColor
()
))
break
;
break
;
else
{
else
{
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
...
@@ -83,10 +84,11 @@ public class Queen extends Piece {
...
@@ -83,10 +84,11 @@ public class Queen extends Piece {
}
}
tempx
=
x
-
1
;
tempx
=
x
-
1
;
tempy
=
y
+
1
;
tempy
=
y
+
1
;
while
(
tempx
>=
0
&&
tempy
<
8
)
{
while
(
tempx
>=
0
&&
tempy
<
8
)
{
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
()
==
null
)
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
()
==
null
)
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
else
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
().
getPieceColor
()
==
this
.
getPieceColor
(
))
else
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
().
getPieceColor
()
.
equals
(
this
.
getPieceColor
()
))
break
;
break
;
else
{
else
{
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
...
@@ -100,7 +102,7 @@ public class Queen extends Piece {
...
@@ -100,7 +102,7 @@ public class Queen extends Piece {
while
(
tempx
>=
0
&&
tempy
>=
0
)
{
while
(
tempx
>=
0
&&
tempy
>=
0
)
{
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
()
==
null
)
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
()
==
null
)
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
else
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
().
getPieceColor
()
==
this
.
getPieceColor
(
))
else
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
().
getPieceColor
()
.
equals
(
this
.
getPieceColor
()
))
break
;
break
;
else
{
else
{
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
...
@@ -114,7 +116,7 @@ public class Queen extends Piece {
...
@@ -114,7 +116,7 @@ public class Queen extends Piece {
while
(
tempx
<
8
&&
tempy
<
8
)
{
while
(
tempx
<
8
&&
tempy
<
8
)
{
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
()
==
null
)
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
()
==
null
)
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
else
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
().
getPieceColor
()
==
this
.
getPieceColor
(
))
else
if
(
boardSquares
[
tempx
][
tempy
].
getPiece
().
getPieceColor
()
.
equals
(
this
.
getPieceColor
()
))
break
;
break
;
else
{
else
{
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
possibleSquares
.
add
(
boardSquares
[
tempx
][
tempy
]);
...
...
src/pieces/Rook.java
View file @
06a3cff9
...
@@ -19,7 +19,7 @@ public class Rook extends Piece {
...
@@ -19,7 +19,7 @@ public class Rook extends Piece {
{
{
if
(
boardSquares
[
tempx
][
y
].
getPiece
()==
null
)
if
(
boardSquares
[
tempx
][
y
].
getPiece
()==
null
)
possibleSquares
.
add
(
boardSquares
[
tempx
][
y
]);
possibleSquares
.
add
(
boardSquares
[
tempx
][
y
]);
else
if
(
boardSquares
[
tempx
][
y
].
getPiece
().
getPieceColor
()
==
this
.
getPieceColor
(
))
else
if
(
boardSquares
[
tempx
][
y
].
getPiece
().
getPieceColor
()
.
equals
(
this
.
getPieceColor
()
))
break
;
break
;
else
else
{
{
...
@@ -33,7 +33,7 @@ public class Rook extends Piece {
...
@@ -33,7 +33,7 @@ public class Rook extends Piece {
{
{
if
(
boardSquares
[
tempx
][
y
].
getPiece
()==
null
)
if
(
boardSquares
[
tempx
][
y
].
getPiece
()==
null
)
possibleSquares
.
add
(
boardSquares
[
tempx
][
y
]);
possibleSquares
.
add
(
boardSquares
[
tempx
][
y
]);
else
if
(
boardSquares
[
tempx
][
y
].
getPiece
().
getPieceColor
()
==
this
.
getPieceColor
(
))
else
if
(
boardSquares
[
tempx
][
y
].
getPiece
().
getPieceColor
()
.
equals
(
this
.
getPieceColor
()
))
break
;
break
;
else
else
{
{
...
@@ -47,7 +47,7 @@ public class Rook extends Piece {
...
@@ -47,7 +47,7 @@ public class Rook extends Piece {
{
{
if
(
boardSquares
[
x
][
tempy
].
getPiece
()==
null
)
if
(
boardSquares
[
x
][
tempy
].
getPiece
()==
null
)
possibleSquares
.
add
(
boardSquares
[
x
][
tempy
]);
possibleSquares
.
add
(
boardSquares
[
x
][
tempy
]);
else
if
(
boardSquares
[
x
][
tempy
].
getPiece
().
getPieceColor
()
==
this
.
getPieceColor
(
))
else
if
(
boardSquares
[
x
][
tempy
].
getPiece
().
getPieceColor
()
.
equals
(
this
.
getPieceColor
()
))
break
;
break
;
else
else
{
{
...
@@ -61,7 +61,7 @@ public class Rook extends Piece {
...
@@ -61,7 +61,7 @@ public class Rook extends Piece {
{
{
if
(
boardSquares
[
x
][
tempy
].
getPiece
()==
null
)
if
(
boardSquares
[
x
][
tempy
].
getPiece
()==
null
)
possibleSquares
.
add
(
boardSquares
[
x
][
tempy
]);
possibleSquares
.
add
(
boardSquares
[
x
][
tempy
]);
else
if
(
boardSquares
[
x
][
tempy
].
getPiece
().
getPieceColor
()
==
this
.
getPieceColor
(
))
else
if
(
boardSquares
[
x
][
tempy
].
getPiece
().
getPieceColor
()
.
equals
(
this
.
getPieceColor
()
))
break
;
break
;
else
else
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment