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
8d5dfa55
Commit
8d5dfa55
authored
5 years ago
by
amir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
possible move javadoc
parent
a67ada9e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
8 deletions
+11
-8
Main.java
Main.java
+3
-0
Player1.java
Player1.java
+0
-1
Players.java
Players.java
+8
-7
No files found.
Main.java
View file @
8d5dfa55
...
...
@@ -22,6 +22,7 @@ public class Main {
System
.
out
.
println
(
"Player1, it's your turn!"
);
}
else
{
//if there is no possible move prints pass
System
.
out
.
println
(
"pass"
);
turns
++;
}
...
...
@@ -30,6 +31,7 @@ public class Main {
if
(
play2
.
numberOfPlayerPossibleMoves
(
play1
.
getArr1
(),
play2
.
getArr2
())
!=
0
)
System
.
out
.
println
(
"Player2, it's your turn!"
);
else
{
//if there is no possible move prints pass
System
.
out
.
println
(
"pass"
);
continue
;
}
...
...
@@ -37,6 +39,7 @@ public class Main {
Scanner
scanner
=
new
Scanner
(
System
.
in
);
String
nl
=
scanner
.
nextLine
();
char
[]
f
=
nl
.
toCharArray
();
// scanning the x and y coordinates from user
int
y
=
f
[
0
]
-
'1'
+
1
;
int
x
=
f
[
2
]
-
'A'
+
1
;
if
((
x
>=
1
)
&&
(
x
<
9
)
&&
(
y
>=
1
)
&&
(
y
<
9
))
{
...
...
This diff is collapsed.
Click to expand it.
Player1.java
View file @
8d5dfa55
...
...
@@ -13,5 +13,4 @@ public class Player1 extends Players {
return
arr1
;
}
}
This diff is collapsed.
Click to expand it.
Players.java
View file @
8d5dfa55
...
...
@@ -110,13 +110,14 @@ public class Players {
}
/**
*
* @param arrOpponent
* @param arr
* @param x
* @param y
* @param moveX
* @param moveY
* this method checks if the move is possible, then equalize the color of the
* player's disc in a line from the blank to the first player's disk that seen
* @param arrOpponent list of opponent discs' coordinates
* @param arr list of the player disc's coordinates
* @param x the x of the blank space
* @param y the y of the blank space
* @param moveX the direction to the x es
* @param moveY the direction to the y es
*/
public
void
equalize
(
int
[][]
arrOpponent
,
int
[][]
arr
,
int
x
,
int
y
,
int
moveX
,
int
moveY
)
{
if
(
checkTheMoveIfPossible
(
arrOpponent
,
arr
,
x
,
y
,
moveX
,
moveY
))
{
...
...
This diff is collapsed.
Click to expand it.
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