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
25e80531
Commit
25e80531
authored
May 13, 2019
by
hamed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve console intraction with app (add raw and column names in board for easier interaction)
parent
7fa5c498
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
Board.java
src/Main/Board.java
+8
-3
Main.java
src/Main/Main.java
+6
-4
No files found.
src/Main/Board.java
View file @
25e80531
...
...
@@ -91,8 +91,10 @@ public class Board {
@Override
public
String
toString
()
{
String
str
=
""
;
String
str
=
" a b c d e f g h\n"
;
str
=
str
+
"------------------\n"
;
for
(
int
j
=
0
;
j
<
8
;
j
++){
str
=
str
+(
j
+
1
)+
"|"
;
for
(
int
i
=
0
;
i
<
7
;
i
++){
if
(
board
[
i
][
j
]!=
null
)
{
str
=
str
+
board
[
i
][
j
]
+
" "
;
...
...
@@ -101,11 +103,14 @@ public class Board {
str
=
str
+
"0 "
;
}
if
(
board
[
7
][
j
]!=
null
)
{
str
=
str
+
board
[
7
][
j
]
+
"\n"
;
str
=
str
+
board
[
7
][
j
];
}
else
str
=
str
+
"0\n"
;
str
=
str
+
"0"
;
str
=
str
+
"|"
+(
j
+
1
)+
"\n"
;
}
str
=
str
+
"------------------\n"
;
str
=
str
+
" a b c d e f g h\n"
;
return
str
;
}
}
src/Main/Main.java
View file @
25e80531
...
...
@@ -33,14 +33,15 @@ public class Main {
continue
;
}
if
(
b
.
getMove
(
x
,
y
,
dx
,
dy
))
{
System
.
out
.
println
(
"Moved"
);
System
.
out
.
println
(
splt
[
0
]+
" Moved to "
+
splt
[
1
]
);
whichMove
=
false
;
}
else
{
System
.
out
.
println
(
"Incorrect Move, Please insert Correct Movement"
);
}
}
}
System
.
out
.
println
(
b
);
if
(!
whichMove
)
System
.
out
.
println
(
b
);
//--------------------------------------------------------------------------
if
(
whichMove
)
continue
;
System
.
out
.
println
(
"Black Turn.... insert a move in a line"
);
...
...
@@ -61,13 +62,14 @@ public class Main {
continue
;
}
if
(
b
.
getMove
(
x
,
y
,
dx
,
dy
)){
System
.
out
.
println
(
"Moved"
);
System
.
out
.
println
(
splt
[
0
]+
" Moved to "
+
splt
[
1
]
);
whichMove
=
true
;
}
else
{
System
.
out
.
println
(
"Incorrect Move, Please insert Correct Movement"
);
}
}
System
.
out
.
println
(
b
);
if
(
whichMove
)
System
.
out
.
println
(
b
);
}
}
public
static
void
printMoves
(
ArrayList
<
int
[]>
moves
){
...
...
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