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
5a06e374
Commit
5a06e374
authored
Apr 13, 2020
by
amir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Displaying in console and graphic version
parent
9e532c5f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
100 additions
and
74 deletions
+100
-74
Graphic.java
Graphic.java
+84
-69
Main.java
Main.java
+16
-5
No files found.
Graphic.java
View file @
5a06e374
...
...
@@ -4,18 +4,85 @@ import javax.swing.*;
import
java.awt.*
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
public
class
Graphic
extends
Display
{
JFrame
f
=
new
JFrame
(
"othello"
);
// creating instance of JFrame
JLabel
l1
;
JButton
b
=
new
JButton
(
"start"
);
ArrayList
<
JButton
>
buttons
=
new
ArrayList
<>();
JButton
button11
=
new
JButton
(
""
);
JButton
button12
=
new
JButton
(
""
);
JButton
button13
=
new
JButton
(
""
);
JButton
button14
=
new
JButton
(
""
);
JButton
button15
=
new
JButton
(
""
);
JButton
button16
=
new
JButton
(
""
);
JButton
button17
=
new
JButton
(
""
);
JButton
button18
=
new
JButton
(
""
);
JButton
button21
=
new
JButton
(
""
);
JButton
button22
=
new
JButton
(
""
);
JButton
button23
=
new
JButton
(
""
);
JButton
button24
=
new
JButton
(
""
);
JButton
button25
=
new
JButton
(
""
);
JButton
button26
=
new
JButton
(
""
);
JButton
button27
=
new
JButton
(
""
);
JButton
button28
=
new
JButton
(
""
);
JButton
button31
=
new
JButton
(
""
);
JButton
button32
=
new
JButton
(
""
);
JButton
button33
=
new
JButton
(
""
);
JButton
button34
=
new
JButton
(
""
);
JButton
button35
=
new
JButton
(
""
);
JButton
button36
=
new
JButton
(
""
);
JButton
button37
=
new
JButton
(
""
);
JButton
button38
=
new
JButton
(
""
);
JButton
button41
=
new
JButton
(
""
);
JButton
button42
=
new
JButton
(
""
);
JButton
button43
=
new
JButton
(
""
);
JButton
button44
=
new
JButton
(
""
);
JButton
button45
=
new
JButton
(
""
);
JButton
button46
=
new
JButton
(
""
);
JButton
button47
=
new
JButton
(
""
);
JButton
button48
=
new
JButton
(
""
);
JButton
button51
=
new
JButton
(
""
);
JButton
button52
=
new
JButton
(
""
);
JButton
button53
=
new
JButton
(
""
);
JButton
button54
=
new
JButton
(
""
);
JButton
button55
=
new
JButton
(
""
);
JButton
button56
=
new
JButton
(
""
);
JButton
button57
=
new
JButton
(
""
);
JButton
button58
=
new
JButton
(
""
);
JButton
button61
=
new
JButton
(
""
);
JButton
button62
=
new
JButton
(
""
);
JButton
button63
=
new
JButton
(
""
);
JButton
button64
=
new
JButton
(
""
);
JButton
button65
=
new
JButton
(
""
);
JButton
button66
=
new
JButton
(
""
);
JButton
button67
=
new
JButton
(
""
);
JButton
button68
=
new
JButton
(
""
);
JButton
button71
=
new
JButton
(
""
);
JButton
button72
=
new
JButton
(
""
);
JButton
button73
=
new
JButton
(
""
);
JButton
button74
=
new
JButton
(
""
);
JButton
button75
=
new
JButton
(
""
);
JButton
button76
=
new
JButton
(
""
);
JButton
button77
=
new
JButton
(
""
);
JButton
button78
=
new
JButton
(
""
);
JButton
button81
=
new
JButton
(
""
);
JButton
button82
=
new
JButton
(
""
);
JButton
button83
=
new
JButton
(
""
);
JButton
button84
=
new
JButton
(
""
);
JButton
button85
=
new
JButton
(
""
);
JButton
button86
=
new
JButton
(
""
);
JButton
button87
=
new
JButton
(
""
);
JButton
button88
=
new
JButton
(
""
);
public
Graphic
(
byte
displayType
)
{
super
(
displayType
);
JFrame
f
=
new
JFrame
(
"othello"
);
// creating instance of JFrame
JLabel
l1
;
l1
=
new
JLabel
(
new
ImageIcon
(
"untitled.png"
));
f
.
setSize
(
700
,
700
);
f
.
setLayout
(
null
);
f
.
setVisible
(
true
);
JButton
b
=
new
JButton
(
"start"
);
f
.
add
(
b
);
b
.
setBounds
(
300
,
621
,
100
,
40
);
//x axis, y axis, width, height
b
.
addActionListener
(
new
ActionListener
()
{
...
...
@@ -26,48 +93,37 @@ public class Graphic extends Display {
b
.
setVisible
(
false
);
}
});
JButton
button11
=
new
JButton
(
""
);
button11
.
setBackground
(
Color
.
GRAY
);
button11
.
setBounds
(
143
,
135
,
58
,
58
);
f
.
add
(
button11
);
buttons
.
add
(
button11
);
JButton
button12
=
new
JButton
(
""
);
button12
.
setBackground
(
Color
.
GRAY
);
button12
.
setBounds
(
143
+
58
,
135
,
58
,
58
);
f
.
add
(
button12
);
buttons
.
add
(
button12
);
JButton
button13
=
new
JButton
(
""
);
button13
.
setBackground
(
Color
.
GRAY
);
button13
.
setBounds
(
143
+
2
*
58
,
135
,
58
,
58
);
f
.
add
(
button13
);
buttons
.
add
(
button13
);
JButton
button14
=
new
JButton
(
""
);
button14
.
setBackground
(
Color
.
GRAY
);
button14
.
setBounds
(
143
+
3
*
58
,
135
,
58
,
58
);
f
.
add
(
button14
);
buttons
.
add
(
button14
);
JButton
button15
=
new
JButton
(
""
);
button15
.
setBackground
(
Color
.
GRAY
);
button15
.
setBounds
(
143
+
4
*
58
,
135
,
58
,
58
);
f
.
add
(
button15
);
buttons
.
add
(
button15
);
JButton
button16
=
new
JButton
(
""
);
button16
.
setBackground
(
Color
.
GRAY
);
button16
.
setBounds
(
143
+
5
*
58
,
135
,
58
,
58
);
f
.
add
(
button16
);
buttons
.
add
(
button16
);
JButton
button17
=
new
JButton
(
""
);
button17
.
setBackground
(
Color
.
GRAY
);
button17
.
setBounds
(
143
+
6
*
58
,
135
,
58
,
58
);
f
.
add
(
button17
);
buttons
.
add
(
button17
);
JButton
button18
=
new
JButton
(
""
);
button18
.
setBackground
(
Color
.
GRAY
);
button18
.
setBounds
(
143
+
7
*
58
,
135
,
58
,
58
);
f
.
add
(
button18
);
buttons
.
add
(
button18
);
JButton
button21
=
new
JButton
(
""
);
button21
.
setBackground
(
Color
.
GRAY
);
button21
.
setBounds
(
143
,
135
+
58
,
58
,
58
);
f
.
add
(
button21
);
buttons
.
add
(
button21
);
JButton
button22
=
new
JButton
(
""
);
button22
.
setBackground
(
Color
.
GRAY
);
button22
.
setBounds
(
143
+
58
,
135
+
58
,
58
,
58
);
f
.
add
(
button22
);
buttons
.
add
(
button22
);
JButton
button23
=
new
JButton
(
""
);
button23
.
setBackground
(
Color
.
GRAY
);
button23
.
setBounds
(
143
+
2
*
58
,
135
+
58
,
58
,
58
);
f
.
add
(
button23
);
buttons
.
add
(
button23
);
...
...
@@ -75,217 +131,165 @@ public class Graphic extends Display {
button24
.
setBackground
(
Color
.
GRAY
);
button24
.
setBounds
(
143
+
3
*
58
,
135
+
58
,
58
,
58
);
f
.
add
(
button24
);
buttons
.
add
(
button24
);
JButton
button25
=
new
JButton
(
""
);
button25
.
setBackground
(
Color
.
GRAY
);
button25
.
setBounds
(
143
+
4
*
58
,
135
+
58
,
58
,
58
);
f
.
add
(
button25
);
buttons
.
add
(
button25
);
JButton
button26
=
new
JButton
(
""
);
button26
.
setBackground
(
Color
.
GRAY
);
button26
.
setBounds
(
143
+
5
*
58
,
135
+
58
,
58
,
58
);
f
.
add
(
button26
);
buttons
.
add
(
button26
);
JButton
button27
=
new
JButton
(
""
);
button27
.
setBackground
(
Color
.
GRAY
);
button27
.
setBounds
(
143
+
6
*
58
,
135
+
58
,
58
,
58
);
f
.
add
(
button27
);
buttons
.
add
(
button27
);
JButton
button28
=
new
JButton
(
""
);
button28
.
setBackground
(
Color
.
GRAY
);
button28
.
setBounds
(
143
+
7
*
58
,
135
+
58
,
58
,
58
);
f
.
add
(
button28
);
buttons
.
add
(
button28
);
JButton
button31
=
new
JButton
(
""
);
button31
.
setBackground
(
Color
.
GRAY
);
button31
.
setBounds
(
143
,
135
+
2
*
58
,
58
,
58
);
f
.
add
(
button31
);
buttons
.
add
(
button31
);
JButton
button32
=
new
JButton
(
""
);
button32
.
setBackground
(
Color
.
GRAY
);
button32
.
setBounds
(
143
+
58
,
135
+
2
*
58
,
58
,
58
);
f
.
add
(
button32
);
buttons
.
add
(
button32
);
JButton
button33
=
new
JButton
(
""
);
button33
.
setBackground
(
Color
.
GRAY
);
button33
.
setBounds
(
143
+
2
*
58
,
135
+
2
*
58
,
58
,
58
);
f
.
add
(
button33
);
buttons
.
add
(
button33
);
JButton
button34
=
new
JButton
(
""
);
button34
.
setBackground
(
Color
.
GRAY
);
button34
.
setBounds
(
143
+
3
*
58
,
135
+
2
*
58
,
58
,
58
);
f
.
add
(
button34
);
buttons
.
add
(
button34
);
JButton
button35
=
new
JButton
(
""
);
button35
.
setBackground
(
Color
.
GRAY
);
button35
.
setBounds
(
143
+
4
*
58
,
135
+
2
*
58
,
58
,
58
);
f
.
add
(
button35
);
buttons
.
add
(
button35
);
JButton
button36
=
new
JButton
(
""
);
button36
.
setBackground
(
Color
.
GRAY
);
button36
.
setBounds
(
143
+
5
*
58
,
135
+
2
*
58
,
58
,
58
);
f
.
add
(
button36
);
buttons
.
add
(
button36
);
JButton
button37
=
new
JButton
(
""
);
button37
.
setBackground
(
Color
.
GRAY
);
button37
.
setBounds
(
143
+
6
*
58
,
135
+
2
*
58
,
58
,
58
);
f
.
add
(
button37
);
buttons
.
add
(
button37
);
JButton
button38
=
new
JButton
(
""
);
button38
.
setBackground
(
Color
.
GRAY
);
button38
.
setBounds
(
143
+
7
*
58
,
135
+
2
*
58
,
58
,
58
);
f
.
add
(
button38
);
buttons
.
add
(
button38
);
JButton
button41
=
new
JButton
(
""
);
button41
.
setBackground
(
Color
.
GRAY
);
button41
.
setBounds
(
143
,
135
+
3
*
58
,
58
,
58
);
f
.
add
(
button41
);
buttons
.
add
(
button41
);
JButton
button42
=
new
JButton
(
""
);
button42
.
setBackground
(
Color
.
GRAY
);
button42
.
setBounds
(
143
+
58
,
135
+
3
*
58
,
58
,
58
);
f
.
add
(
button42
);
buttons
.
add
(
button42
);
JButton
button43
=
new
JButton
(
""
);
button43
.
setBackground
(
Color
.
GRAY
);
button43
.
setBounds
(
143
+
2
*
58
,
135
+
3
*
58
,
58
,
58
);
f
.
add
(
button43
);
buttons
.
add
(
button43
);
JButton
button44
=
new
JButton
(
""
);
button44
.
setBackground
(
Color
.
WHITE
);
button44
.
setBounds
(
143
+
3
*
58
,
135
+
3
*
58
,
58
,
58
);
f
.
add
(
button44
);
buttons
.
add
(
button44
);
JButton
button45
=
new
JButton
(
""
);
button45
.
setBackground
(
Color
.
BLACK
);
button45
.
setBounds
(
143
+
4
*
58
,
135
+
3
*
58
,
58
,
58
);
f
.
add
(
button45
);
buttons
.
add
(
button45
);
JButton
button46
=
new
JButton
(
""
);
button46
.
setBackground
(
Color
.
GRAY
);
button46
.
setBounds
(
143
+
5
*
58
,
135
+
3
*
58
,
58
,
58
);
f
.
add
(
button46
);
buttons
.
add
(
button46
);
JButton
button47
=
new
JButton
(
""
);
button47
.
setBackground
(
Color
.
GRAY
);
button47
.
setBounds
(
143
+
6
*
58
,
135
+
3
*
58
,
58
,
58
);
f
.
add
(
button47
);
buttons
.
add
(
button47
);
JButton
button48
=
new
JButton
(
""
);
button48
.
setBackground
(
Color
.
GRAY
);
button48
.
setBounds
(
143
+
7
*
58
,
135
+
3
*
58
,
58
,
58
);
f
.
add
(
button48
);
buttons
.
add
(
button48
);
JButton
button51
=
new
JButton
(
""
);
button51
.
setBackground
(
Color
.
GRAY
);
button51
.
setBounds
(
143
,
135
+
4
*
58
,
58
,
58
);
f
.
add
(
button51
);
buttons
.
add
(
button51
);
JButton
button52
=
new
JButton
(
""
);
button52
.
setBackground
(
Color
.
GRAY
);
button52
.
setBounds
(
143
+
58
,
135
+
4
*
58
,
58
,
58
);
f
.
add
(
button52
);
buttons
.
add
(
button52
);
JButton
button53
=
new
JButton
(
""
);
button53
.
setBackground
(
Color
.
GRAY
);
button53
.
setBounds
(
143
+
2
*
58
,
135
+
4
*
58
,
58
,
58
);
f
.
add
(
button53
);
buttons
.
add
(
button53
);
JButton
button54
=
new
JButton
(
""
);
button54
.
setBackground
(
Color
.
BLACK
);
button54
.
setBounds
(
143
+
3
*
58
,
135
+
4
*
58
,
58
,
58
);
f
.
add
(
button54
);
buttons
.
add
(
button54
);
JButton
button55
=
new
JButton
(
""
);
button55
.
setBackground
(
Color
.
WHITE
);
button55
.
setBounds
(
143
+
4
*
58
,
135
+
4
*
58
,
58
,
58
);
f
.
add
(
button55
);
buttons
.
add
(
button55
);
JButton
button56
=
new
JButton
(
""
);
button56
.
setBackground
(
Color
.
GRAY
);
button56
.
setBounds
(
143
+
5
*
58
,
135
+
4
*
58
,
58
,
58
);
f
.
add
(
button56
);
buttons
.
add
(
button56
);
JButton
button57
=
new
JButton
(
""
);
button57
.
setBackground
(
Color
.
GRAY
);
button57
.
setBounds
(
143
+
6
*
58
,
135
+
4
*
58
,
58
,
58
);
f
.
add
(
button57
);
buttons
.
add
(
button57
);
JButton
button58
=
new
JButton
(
""
);
button58
.
setBackground
(
Color
.
GRAY
);
button58
.
setBounds
(
143
+
7
*
58
,
135
+
4
*
58
,
58
,
58
);
f
.
add
(
button58
);
buttons
.
add
(
button58
);
JButton
button61
=
new
JButton
(
""
);
button61
.
setBackground
(
Color
.
GRAY
);
button61
.
setBounds
(
143
,
135
+
5
*
58
,
58
,
58
);
f
.
add
(
button61
);
buttons
.
add
(
button61
);
JButton
button62
=
new
JButton
(
""
);
button62
.
setBackground
(
Color
.
GRAY
);
button62
.
setBounds
(
143
+
58
,
135
+
5
*
58
,
58
,
58
);
f
.
add
(
button62
);
buttons
.
add
(
button62
);
JButton
button63
=
new
JButton
(
""
);
button63
.
setBackground
(
Color
.
GRAY
);
button63
.
setBounds
(
143
+
2
*
58
,
135
+
5
*
58
,
58
,
58
);
f
.
add
(
button63
);
buttons
.
add
(
button63
);
JButton
button64
=
new
JButton
(
""
);
button64
.
setBackground
(
Color
.
GRAY
);
button64
.
setBounds
(
143
+
3
*
58
,
135
+
5
*
58
,
58
,
58
);
f
.
add
(
button64
);
buttons
.
add
(
button64
);
JButton
button65
=
new
JButton
(
""
);
button65
.
setBackground
(
Color
.
GRAY
);
button65
.
setBounds
(
143
+
4
*
58
,
135
+
5
*
58
,
58
,
58
);
f
.
add
(
button65
);
buttons
.
add
(
button65
);
JButton
button66
=
new
JButton
(
""
);
button66
.
setBackground
(
Color
.
GRAY
);
button66
.
setBounds
(
143
+
5
*
58
,
135
+
5
*
58
,
58
,
58
);
f
.
add
(
button66
);
buttons
.
add
(
button66
);
JButton
button67
=
new
JButton
(
""
);
button67
.
setBackground
(
Color
.
GRAY
);
button67
.
setBounds
(
143
+
6
*
58
,
135
+
5
*
58
,
58
,
58
);
f
.
add
(
button67
);
buttons
.
add
(
button67
);
JButton
button68
=
new
JButton
(
""
);
button68
.
setBackground
(
Color
.
GRAY
);
button68
.
setBounds
(
143
+
7
*
58
,
135
+
5
*
58
,
58
,
58
);
f
.
add
(
button68
);
buttons
.
add
(
button68
);
JButton
button71
=
new
JButton
(
""
);
button71
.
setBackground
(
Color
.
GRAY
);
button71
.
setBounds
(
143
,
135
+
6
*
58
,
58
,
58
);
f
.
add
(
button71
);
buttons
.
add
(
button71
);
JButton
button72
=
new
JButton
(
""
);
button72
.
setBackground
(
Color
.
GRAY
);
button72
.
setBounds
(
143
+
58
,
135
+
6
*
58
,
58
,
58
);
f
.
add
(
button72
);
buttons
.
add
(
button72
);
JButton
button73
=
new
JButton
(
""
);
button73
.
setBackground
(
Color
.
GRAY
);
button73
.
setBounds
(
143
+
2
*
58
,
135
+
6
*
58
,
58
,
58
);
f
.
add
(
button73
);
buttons
.
add
(
button73
);
JButton
button74
=
new
JButton
(
""
);
button74
.
setBackground
(
Color
.
GRAY
);
button74
.
setBounds
(
143
+
3
*
58
,
135
+
6
*
58
,
58
,
58
);
f
.
add
(
button74
);
buttons
.
add
(
button74
);
JButton
button75
=
new
JButton
(
""
);
button75
.
setBackground
(
Color
.
GRAY
);
button75
.
setBounds
(
143
+
4
*
58
,
135
+
6
*
58
,
58
,
58
);
f
.
add
(
button75
);
buttons
.
add
(
button75
);
JButton
button76
=
new
JButton
(
""
);
button76
.
setBackground
(
Color
.
GRAY
);
button76
.
setBounds
(
143
+
5
*
58
,
135
+
6
*
58
,
58
,
58
);
f
.
add
(
button76
);
buttons
.
add
(
button76
);
JButton
button77
=
new
JButton
(
""
);
button77
.
setBackground
(
Color
.
GRAY
);
button77
.
setBounds
(
143
+
6
*
58
,
135
+
6
*
58
,
58
,
58
);
f
.
add
(
button77
);
buttons
.
add
(
button77
);
JButton
button78
=
new
JButton
(
""
);
button78
.
setBackground
(
Color
.
GRAY
);
button78
.
setBounds
(
143
+
7
*
58
,
135
+
6
*
58
,
58
,
58
);
f
.
add
(
button78
);
buttons
.
add
(
button78
);
JButton
button81
=
new
JButton
(
""
);
button81
.
setBackground
(
Color
.
GRAY
);
button81
.
setBounds
(
143
,
135
+
7
*
58
,
58
,
58
);
f
.
add
(
button81
);
buttons
.
add
(
button81
);
JButton
button82
=
new
JButton
(
""
);
button82
.
setBackground
(
Color
.
GRAY
);
button82
.
setBounds
(
143
+
58
,
135
+
7
*
58
,
58
,
58
);
f
.
add
(
button82
);
buttons
.
add
(
button82
);
JButton
button83
=
new
JButton
(
""
);
button83
.
setBackground
(
Color
.
GRAY
);
button83
.
setBounds
(
143
+
2
*
58
,
135
+
7
*
58
,
58
,
58
);
f
.
add
(
button83
);
buttons
.
add
(
button83
);
JButton
button84
=
new
JButton
(
""
);
button84
.
setBackground
(
Color
.
GRAY
);
button84
.
setBounds
(
143
+
3
*
58
,
135
+
7
*
58
,
58
,
58
);
f
.
add
(
button84
);
buttons
.
add
(
button84
);
JButton
button85
=
new
JButton
(
""
);
button85
.
setBackground
(
Color
.
GRAY
);
button85
.
setBounds
(
143
+
4
*
58
,
135
+
7
*
58
,
58
,
58
);
f
.
add
(
button85
);
buttons
.
add
(
button85
);
JButton
button86
=
new
JButton
(
""
);
button86
.
setBackground
(
Color
.
GRAY
);
button86
.
setBounds
(
143
+
5
*
58
,
135
+
7
*
58
,
58
,
58
);
f
.
add
(
button86
);
buttons
.
add
(
button86
);
JButton
button87
=
new
JButton
(
""
);
button87
.
setBackground
(
Color
.
GRAY
);
button87
.
setBounds
(
143
+
6
*
58
,
135
+
7
*
58
,
58
,
58
);
f
.
add
(
button87
);
buttons
.
add
(
button87
);
JButton
button88
=
new
JButton
(
""
);
button88
.
setBackground
(
Color
.
GRAY
);
button88
.
setBounds
(
143
+
7
*
58
,
135
+
7
*
58
,
58
,
58
);
f
.
add
(
button88
);
buttons
.
add
(
button88
);
...
...
@@ -298,18 +302,29 @@ public class Graphic extends Display {
for
(
int
j
=
1
;
j
<=
8
;
j
++)
{
if
(
a2
[
j
][
i
]
!=
0
)
{
// the unicode of white circle (there is a player2 disc)
searchInButtons
(
j
,
i
).
setBackground
(
Color
.
WHITE
);
}
else
{
if
(
a1
[
j
][
i
]
!=
0
)
{
// the unicode of black circle (there is a player1 disc)
System
.
out
.
print
(
'\
u25CF
'
);
searchInButtons
(
j
,
i
).
setBackground
(
Color
.
BLACK
);
}
else
// the unicode of white square (a blank)
System
.
out
.
print
(
'\
u25A1
'
);
searchInButtons
(
j
,
i
).
setBackground
(
Color
.
GRAY
);
}
}
}
}
public
JButton
searchInButtons
(
int
x
,
int
y
){
Iterator
<
JButton
>
buttonIterator
=
buttons
.
iterator
();
while
(
buttonIterator
.
hasNext
()){
JButton
b1
=
buttonIterator
.
next
();
if
(
b1
.
getX
()
==
(
x
-
1
)
*
58
+
143
&&
b1
.
getY
()
==
(
y
-
1
)
*
58
+
135
)
{
return
b1
;
}
}
return
null
;
}
}
Main.java
View file @
5a06e374
...
...
@@ -9,11 +9,17 @@ public class Main {
System
.
out
.
println
(
"What type of game do you want? 0)console 1)graphic"
);
Scanner
scanner
=
new
Scanner
(
System
.
in
);
byte
displayType
=
scanner
.
nextByte
();
Players
players
=
new
Players
();
Player1
play1
=
new
Player1
();
Player2
play2
=
new
Player2
();
players
.
display
(
play1
.
getArr1
(),
play2
.
getArr2
(),
displayType
);
while
((
play1
.
getNumberOfDisks
(
play1
.
getArr1
())
+
play2
.
getNumberOfDisks
(
play2
.
getArr2
())
<
64
)
&&
if
(
displayType
==
0
)
{
Console
console
=
new
Console
(
displayType
);
console
.
display
(
play1
.
getArr1
(),
play2
.
getArr2
());
}
else
{
Graphic
graphic
=
new
Graphic
(
displayType
);
graphic
.
display
(
play1
.
getArr1
(),
play2
.
getArr2
());
}
/* while ((play1.getNumberOfDisks(play1.getArr1()) + play2.getNumberOfDisks(play2.getArr2()) < 64) &&
(play1.getNumberOfDisks(play1.getArr1()) != 0) && (play2.getNumberOfDisks(play2.getArr2()) != 0))
{
if ((play1.numberOfPlayerPossibleMoves(play2.getArr2(), play1.getArr1()) == 0) &&
...
...
@@ -54,13 +60,18 @@ public class Main {
}
}
players
.
display
(
play1
.
getArr1
(),
play2
.
getArr2
(),
displayType
);
if (displayType == 0) {
console.display(play1.getArr1(), play2.getArr2());
}
else {
graphic.display(play1.getArr1(), play2.getArr2());
}
//System.out.println("player1: "+play1.getNumberOfDisks1()+" player2:"+play2.getNumberOfDisks2());
}
if (play1.getNumberOfDisks(play1.getArr1()) > play2.getNumberOfDisks(play2.getArr2()))
System.out.println("Player1 wins!");
else
System
.
out
.
println
(
"Player2 wins!"
);
System.out.println("Player2 wins!");
*/
}
...
...
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