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
Expand all
Show 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
This diff is collapsed.
Click to expand it.
Main.java
View file @
5a06e374
...
@@ -9,11 +9,17 @@ public class Main {
...
@@ -9,11 +9,17 @@ public class Main {
System
.
out
.
println
(
"What type of game do you want? 0)console 1)graphic"
);
System
.
out
.
println
(
"What type of game do you want? 0)console 1)graphic"
);
Scanner
scanner
=
new
Scanner
(
System
.
in
);
Scanner
scanner
=
new
Scanner
(
System
.
in
);
byte
displayType
=
scanner
.
nextByte
();
byte
displayType
=
scanner
.
nextByte
();
Players
players
=
new
Players
();
Player1
play1
=
new
Player1
();
Player1
play1
=
new
Player1
();
Player2
play2
=
new
Player2
();
Player2
play2
=
new
Player2
();
players
.
display
(
play1
.
getArr1
(),
play2
.
getArr2
(),
displayType
);
if
(
displayType
==
0
)
{
while
((
play1
.
getNumberOfDisks
(
play1
.
getArr1
())
+
play2
.
getNumberOfDisks
(
play2
.
getArr2
())
<
64
)
&&
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))
(play1.getNumberOfDisks(play1.getArr1()) != 0) && (play2.getNumberOfDisks(play2.getArr2()) != 0))
{
{
if ((play1.numberOfPlayerPossibleMoves(play2.getArr2(), play1.getArr1()) == 0) &&
if ((play1.numberOfPlayerPossibleMoves(play2.getArr2(), play1.getArr1()) == 0) &&
...
@@ -54,13 +60,18 @@ public class Main {
...
@@ -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());
//System.out.println("player1: "+play1.getNumberOfDisks1()+" player2:"+play2.getNumberOfDisks2());
}
}
if (play1.getNumberOfDisks(play1.getArr1()) > play2.getNumberOfDisks(play2.getArr2()))
if (play1.getNumberOfDisks(play1.getArr1()) > play2.getNumberOfDisks(play2.getArr2()))
System.out.println("Player1 wins!");
System.out.println("Player1 wins!");
else
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