Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
ChessProject
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
9631413
ChessProject
Commits
2632294b
Commit
2632294b
authored
May 13, 2019
by
hamed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
king movement bug fixed & console interaction improved
parent
25e80531
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
Main.java
src/Main/Main.java
+10
-2
King.java
src/Pieces/King.java
+1
-1
No files found.
src/Main/Main.java
View file @
2632294b
...
...
@@ -13,6 +13,8 @@ public class Main {
// }
// System.out.println(b);
boolean
whichMove
=
true
;
boolean
isBlackPrintBoard
=
false
;
boolean
isWhitePrintBoard
=
false
;
while
(
true
){
if
(
whichMove
)
{
System
.
out
.
println
(
"White Turn.... insert a move in a line"
);
...
...
@@ -35,13 +37,16 @@ public class Main {
if
(
b
.
getMove
(
x
,
y
,
dx
,
dy
))
{
System
.
out
.
println
(
splt
[
0
]+
" Moved to "
+
splt
[
1
]);
whichMove
=
false
;
isWhitePrintBoard
=
true
;
}
else
{
System
.
out
.
println
(
"Incorrect Move, Please insert Correct Movement"
);
}
}
}
if
(
!
whichMove
)
if
(
isWhitePrintBoard
)
{
System
.
out
.
println
(
b
);
isWhitePrintBoard
=
false
;
}
//--------------------------------------------------------------------------
if
(
whichMove
)
continue
;
System
.
out
.
println
(
"Black Turn.... insert a move in a line"
);
...
...
@@ -64,12 +69,15 @@ public class Main {
if
(
b
.
getMove
(
x
,
y
,
dx
,
dy
)){
System
.
out
.
println
(
splt
[
0
]+
" Moved to "
+
splt
[
1
]);
whichMove
=
true
;
isBlackPrintBoard
=
true
;
}
else
{
System
.
out
.
println
(
"Incorrect Move, Please insert Correct Movement"
);
}
}
if
(
whichMove
)
if
(
isBlackPrintBoard
)
{
System
.
out
.
println
(
b
);
isBlackPrintBoard
=
false
;
}
}
}
public
static
void
printMoves
(
ArrayList
<
int
[]>
moves
){
...
...
src/Pieces/King.java
View file @
2632294b
...
...
@@ -47,7 +47,7 @@ public class King extends Piece {
for
(
int
i
=
0
;
i
<
8
;
i
++){
for
(
int
j
=
0
;
j
<
8
;
j
++){
Piece
p
=
getBoard
().
getBoard
()[
i
][
j
];
if
(
p
!=
null
&&
(
p
.
isWhite
()!=
isWhite
(
))){
if
(
p
!=
null
&&
!(
p
instanceof
King
)
&&((
p
.
isWhite
()&&
isBlack
())
||(
p
.
isBlack
()
&&
isWhite
()
))){
ArrayList
<
int
[]>
moves
=
p
.
moves
();
for
(
int
m
[]
:
moves
){
Cell
c
=
new
Cell
(
m
[
0
],
m
[
1
]);
...
...
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