Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Project_part1_Rezvanian_9831029
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
9831029
Project_part1_Rezvanian_9831029
Commits
3422efaf
Commit
3422efaf
authored
Apr 03, 2020
by
Haj Rezvan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Check for doesn't null map & visualMap elements
parent
6a106bd8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
Board.java
Board.java
+7
-3
No files found.
Board.java
View file @
3422efaf
...
@@ -5,6 +5,7 @@ import java.io.IOException;
...
@@ -5,6 +5,7 @@ import java.io.IOException;
* @author Rezvanian 9831029
* @author Rezvanian 9831029
* @version 0.0
* @version 0.0
*/
*/
public
class
Board
implements
IBoard
{
public
class
Board
implements
IBoard
{
private
final
int
SIZE
=
9
;
private
final
int
SIZE
=
9
;
//for programmer
//for programmer
...
@@ -16,6 +17,7 @@ public class Board implements IBoard {
...
@@ -16,6 +17,7 @@ public class Board implements IBoard {
* This constructor, initialise the fields.
* This constructor, initialise the fields.
*/
*/
public
Board
(){
public
Board
(){
map
=
new
char
[
81
];
map
=
new
char
[
81
];
for
(
int
i
=
0
;
i
<
SIZE
*
SIZE
;
i
++){
for
(
int
i
=
0
;
i
<
SIZE
*
SIZE
;
i
++){
switch
(
i
){
switch
(
i
){
...
@@ -71,6 +73,7 @@ public class Board implements IBoard {
...
@@ -71,6 +73,7 @@ public class Board implements IBoard {
this
.
map
[
i
]
=
'8'
;
this
.
map
[
i
]
=
'8'
;
}
}
default
:{
default
:{
if
(
this
.
map
[
i
]
!=
'w'
||
this
.
map
[
i
]
!=
'b'
)
this
.
map
[
i
]
=
' '
;
this
.
map
[
i
]
=
' '
;
}
}
}
}
...
@@ -84,6 +87,7 @@ public class Board implements IBoard {
...
@@ -84,6 +87,7 @@ public class Board implements IBoard {
}
else
if
(
yColumn
%
8
==
0
){
}
else
if
(
yColumn
%
8
==
0
){
visualMap
[
xRow
][
yColumn
]
=
'*'
;
visualMap
[
xRow
][
yColumn
]
=
'*'
;
}
else
{
}
else
{
if
(
this
.
visualMap
[
xRow
][
yColumn
]
!=
'w'
||
this
.
visualMap
[
xRow
][
yColumn
]
!=
'b'
)
visualMap
[
xRow
][
yColumn
]
=
' '
;
visualMap
[
xRow
][
yColumn
]
=
' '
;
}
}
}
}
...
@@ -144,7 +148,7 @@ public class Board implements IBoard {
...
@@ -144,7 +148,7 @@ public class Board implements IBoard {
public
void
setVisualMapByPosition
(
int
xPosition
,
int
yPosition
,
char
nut
){
public
void
setVisualMapByPosition
(
int
xPosition
,
int
yPosition
,
char
nut
){
xPosition
=
8
*
(
xPosition
-
1
)
+
4
;
xPosition
=
8
*
(
xPosition
-
1
)
+
4
;
yPosition
=
4
*
(
yPosition
-
1
)
+
2
;
yPosition
=
4
*
(
yPosition
-
1
)
+
2
;
visualMap
[
yPosition
][
xPosition
]
=
nut
;
this
.
visualMap
[
yPosition
][
xPosition
]
=
nut
;
}
}
public
int
searchPosition
(
char
c
){
public
int
searchPosition
(
char
c
){
...
...
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