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
5aa08fcb
Commit
5aa08fcb
authored
May 17, 2019
by
hamed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Final Ver2
parent
66d91632
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
Board.java
src/Main/Board.java
+14
-0
ChessFrame.java
src/Main/ChessFrame.java
+7
-0
Bishop.java
src/Pieces/Bishop.java
+1
-1
No files found.
src/Main/Board.java
View file @
5aa08fcb
...
...
@@ -142,6 +142,20 @@ public class Board {
}
return
false
;
}
public
boolean
checkGameOver
(
boolean
isWhite
){
if
(!
KishCheck
(
isWhite
))
return
false
;
if
(
isWhite
){
if
(
whiteKing
.
moves
().
isEmpty
()){
return
true
;
}
}
else
{
if
(
blackKing
.
moves
().
isEmpty
())
{
return
true
;
}
}
return
false
;
}
public
Piece
[][]
getBoard
()
{
return
board
;
}
...
...
src/Main/ChessFrame.java
View file @
5aa08fcb
...
...
@@ -150,9 +150,16 @@ public class ChessFrame extends JFrame implements MouseListener, MouseMotionList
g
.
setFont
(
new
Font
(
"Arial"
,
Font
.
BOLD
,
18
));
if
(
b
.
KishCheck
(
true
)){
g
.
drawString
(
"Kish of White King ..."
,
WIDTH
+
WIDTH_2
/
3
,
yBias
+
HEIGHT
/
2
);
if
(
b
.
checkGameOver
(
true
)){
g
.
drawString
(
"Black Color is Win ..."
,
WIDTH
+
WIDTH_2
/
3
,
yBias
+
yBias
+
HEIGHT
/
2
);
}
}
else
if
(
b
.
KishCheck
(
false
)){
g
.
drawString
(
"Kish of Black King ..."
,
WIDTH
+
WIDTH_2
/
3
,
yBias
+
HEIGHT
/
2
);
if
(
b
.
checkGameOver
(
false
)){
g
.
drawString
(
"White Color is Win ..."
,
WIDTH
+
WIDTH_2
/
3
,
yBias
+
yBias
+
HEIGHT
/
2
);
}
}
else
if
(
b
.
isWhiteMove
())
{
g
.
drawString
(
"White Turn..."
,
WIDTH
+
WIDTH_2
/
3
,
yBias
+
HEIGHT
/
2
);
}
else
if
(!
b
.
isWhiteMove
())
{
...
...
src/Pieces/Bishop.java
View file @
5aa08fcb
...
...
@@ -14,7 +14,7 @@ public class Bishop extends Piece {
public
Bishop
(
int
x
,
int
y
,
boolean
isWhite
,
Board
board
)
{
super
(
x
,
y
,
isWhite
,
board
);
}
@Override
public
boolean
isValidMove
(
int
dx
,
int
dy
)
{
// if(!isCanMove(dx, dy)) return false;
...
...
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