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
21009d47
Commit
21009d47
authored
May 29, 2019
by
9611046
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
getMyX(),getMyY() method in square completed and isChecked completed in main
parent
976acca3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
282 additions
and
292 deletions
+282
-292
Main.java
src/game/Main.java
+271
-289
Square.java
src/game/Square.java
+10
-2
King.java
src/pieces/King.java
+1
-1
No files found.
src/game/Main.java
View file @
21009d47
This diff is collapsed.
Click to expand it.
src/game/Square.java
View file @
21009d47
...
...
@@ -10,8 +10,8 @@ import java.awt.*;
*/
public
class
Square
extends
JButton
{
int
x
;
int
y
;
private
int
x
;
private
int
y
;
private
Piece
piece
;
private
boolean
isSelected
=
false
;
private
boolean
hasPiece
=
false
;
...
...
@@ -30,6 +30,14 @@ public class Square extends JButton {
}
public
int
getMyX
()
{
return
x
;
}
public
int
getMyY
(){
return
y
;
}
public
JLabel
getImage
()
{
return
image
;
}
...
...
src/pieces/King.java
View file @
21009d47
...
...
@@ -35,7 +35,7 @@ public class King extends Piece {
public
ArrayList
<
Square
>
move
(
Square
[][]
squares
,
int
x
,
int
y
){
//The java.util.ArrayList.clear() method removes all of the elements from this list.The list will be empty after this call returns.
ArrayList
<
Square
>
possibleSquares
=
new
ArrayList
<>();
possibleSquares
.
clear
();
int
posx
[]={
x
,
x
,
x
+
1
,
x
+
1
,
x
+
1
,
x
-
1
,
x
-
1
,
x
-
1
};
int
posy
[]={
y
-
1
,
y
+
1
,
y
-
1
,
y
,
y
+
1
,
y
-
1
,
y
,
y
+
1
};
for
(
int
i
=
0
;
i
<
8
;
i
++)
...
...
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