Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
AP Lab 7
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
Omid Sayfun
AP Lab 7
Commits
396290a7
Commit
396290a7
authored
Apr 27, 2019
by
Omid Sayfun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Possible fix for Queen move
parent
59b24e08
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
Bishop.java
lab/game/Bishop.java
+10
-2
Board.java
lab/game/Board.java
+4
-4
No files found.
lab/game/Bishop.java
View file @
396290a7
...
...
@@ -23,8 +23,16 @@ public class Bishop extends Piece{
}
public
boolean
checkWay
(
ArrayList
<
Piece
>
pieces
,
char
x
,
int
y
){
int
xShift
=
(
x
-
this
.
x
)
/
Math
.
abs
(
x
-
this
.
x
);;
int
yShift
=
(
y
-
this
.
y
)
/
Math
.
abs
(
y
-
this
.
y
);
int
xShift
=
0
;
int
yShift
=
0
;
if
(
this
.
x
-
x
!=
0
){
xShift
=
(
x
-
this
.
x
)
/
Math
.
abs
(
x
-
this
.
x
);
}
if
(
this
.
y
-
y
!=
0
){
yShift
=
(
y
-
this
.
y
)
/
Math
.
abs
(
y
-
this
.
y
);
}
int
i
=
1
;
while
(
x
!=
(
char
)(
this
.
x
+
i
*
xShift
)
&&
y
!=
this
.
y
+
i
*
yShift
){
if
(
checkTaken
(
pieces
,
(
char
)(
this
.
x
+
i
*
xShift
),
this
.
y
+
i
*
yShift
)
){
...
...
lab/game/Board.java
View file @
396290a7
...
...
@@ -33,10 +33,10 @@ public class Board{
this
.
whitePieces
.
add
(
newBishop
);
}
// Queen
Queen
whiteQueen
=
new
Queen
(
'
E'
,
1
,
true
,
"WQ"
);
Queen
whiteQueen
=
new
Queen
(
'
D'
,
1
,
true
,
"WQ"
);
this
.
whitePieces
.
add
(
whiteQueen
);
// King
King
whiteKing
=
new
King
(
'
D
'
,
1
,
true
,
"WK"
);
King
whiteKing
=
new
King
(
'
E
'
,
1
,
true
,
"WK"
);
this
.
whitePieces
.
add
(
whiteKing
);
// Black Players
// Pawns
...
...
@@ -60,10 +60,10 @@ public class Board{
this
.
blackPieces
.
add
(
newBishop
);
}
// Queen
Queen
blackQueen
=
new
Queen
(
'
E
'
,
8
,
false
,
"BQ"
);
Queen
blackQueen
=
new
Queen
(
'
D
'
,
8
,
false
,
"BQ"
);
this
.
blackPieces
.
add
(
blackQueen
);
// King
King
blackKing
=
new
King
(
'
D
'
,
8
,
false
,
"BK"
);
King
blackKing
=
new
King
(
'
E
'
,
8
,
false
,
"BK"
);
this
.
blackPieces
.
add
(
blackKing
);
}
...
...
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