Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Project1Othello
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
9831113
Project1Othello
Commits
9e532c5f
Commit
9e532c5f
authored
Apr 13, 2020
by
amir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding graphic version
parent
13f1fbcc
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
358 additions
and
34 deletions
+358
-34
Console.java
Console.java
+29
-1
Display.java
Display.java
+17
-0
Graphic.java
Graphic.java
+311
-1
Players.java
Players.java
+1
-32
No files found.
Console.java
View file @
9e532c5f
package
com
.
company
;
public
class
Console
{
public
class
Console
extends
Display
{
public
Console
(
byte
displayType
)
{
super
(
displayType
);
}
@Override
public
void
display
(
int
[][]
a1
,
int
[][]
a2
)
{
super
.
display
(
a1
,
a2
);
System
.
out
.
println
(
" A B C D E F G H"
);
for
(
int
i
=
1
;
i
<=
8
;
i
++)
{
for
(
int
j
=
1
;
j
<=
8
;
j
++)
{
if
(
a2
[
j
][
i
]
!=
0
)
{
// the unicode of white circle (there is a player2 disc)
System
.
out
.
print
(
'\
u25CB
'
);
}
else
{
if
(
a1
[
j
][
i
]
!=
0
)
{
// the unicode of black circle (there is a player1 disc)
System
.
out
.
print
(
'\
u25CF
'
);
}
else
// the unicode of white square (a blank)
System
.
out
.
print
(
'\
u25A1
'
);
}
System
.
out
.
print
(
" "
);
}
System
.
out
.
println
();
}
}
}
Display.java
0 → 100644
View file @
9e532c5f
package
com
.
company
;
public
class
Display
{
private
byte
displayType
;
public
Display
(
byte
displayType
){
this
.
displayType
=
displayType
;
}
/**
* displays the place of black and white discs and blanks (will be overridden in console and graphic version)
* @param a1 array of the player1's discs
* @param a2 array of the player2's discs
*/
public
void
display
(
int
[][]
a1
,
int
[][]
a2
){
}
}
Graphic.java
View file @
9e532c5f
This diff is collapsed.
Click to expand it.
Players.java
View file @
9e532c5f
...
...
@@ -80,38 +80,7 @@ public class Players {
}
}
/**
* displays the place of black and white discs and blanks
* @param a1 array of the player1's discs
* @param a2 array of the player2's discs
* @param displayType type of display
*/
public
void
display
(
int
[][]
a1
,
int
[][]
a2
,
byte
displayType
){
if
(
displayType
==
0
)
{
System
.
out
.
println
(
" A B C D E F G H"
);
}
for
(
int
i
=
1
;
i
<=
8
;
i
++){
if
(
displayType
==
0
)
System
.
out
.
print
(
i
+
" "
);
for
(
int
j
=
1
;
j
<=
8
;
j
++)
{
if
(
containsInArray
(
a2
,
j
,
i
))
{
// the unicode of white circle (there is a player2 disc)
System
.
out
.
print
(
'\
u25CB
'
);
}
else
{
if
(
containsInArray
(
a1
,
j
,
i
))
{
// the unicode of black circle (there is a player1 disc)
System
.
out
.
print
(
'\
u25CF
'
);
}
else
// the unicode of white square (a blank)
System
.
out
.
print
(
'\
u25A1
'
);
}
System
.
out
.
print
(
" "
);
}
System
.
out
.
println
();
}
}
/**
* this method checks if the move is possible, then equalize the color of the
...
...
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