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
Apr 06, 2020
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 {
...
@@ -22,6 +22,7 @@ public class Main {
System
.
out
.
println
(
"Player1, it's your turn!"
);
System
.
out
.
println
(
"Player1, it's your turn!"
);
}
}
else
{
else
{
//if there is no possible move prints pass
System
.
out
.
println
(
"pass"
);
System
.
out
.
println
(
"pass"
);
turns
++;
turns
++;
}
}
...
@@ -30,6 +31,7 @@ public class Main {
...
@@ -30,6 +31,7 @@ public class Main {
if
(
play2
.
numberOfPlayerPossibleMoves
(
play1
.
getArr1
(),
play2
.
getArr2
())
!=
0
)
if
(
play2
.
numberOfPlayerPossibleMoves
(
play1
.
getArr1
(),
play2
.
getArr2
())
!=
0
)
System
.
out
.
println
(
"Player2, it's your turn!"
);
System
.
out
.
println
(
"Player2, it's your turn!"
);
else
{
else
{
//if there is no possible move prints pass
System
.
out
.
println
(
"pass"
);
System
.
out
.
println
(
"pass"
);
continue
;
continue
;
}
}
...
@@ -37,6 +39,7 @@ public class Main {
...
@@ -37,6 +39,7 @@ public class Main {
Scanner
scanner
=
new
Scanner
(
System
.
in
);
Scanner
scanner
=
new
Scanner
(
System
.
in
);
String
nl
=
scanner
.
nextLine
();
String
nl
=
scanner
.
nextLine
();
char
[]
f
=
nl
.
toCharArray
();
char
[]
f
=
nl
.
toCharArray
();
// scanning the x and y coordinates from user
int
y
=
f
[
0
]
-
'1'
+
1
;
int
y
=
f
[
0
]
-
'1'
+
1
;
int
x
=
f
[
2
]
-
'A'
+
1
;
int
x
=
f
[
2
]
-
'A'
+
1
;
if
((
x
>=
1
)
&&
(
x
<
9
)
&&
(
y
>=
1
)
&&
(
y
<
9
))
{
if
((
x
>=
1
)
&&
(
x
<
9
)
&&
(
y
>=
1
)
&&
(
y
<
9
))
{
...
...
Player1.java
View file @
8d5dfa55
...
@@ -13,5 +13,4 @@ public class Player1 extends Players {
...
@@ -13,5 +13,4 @@ public class Player1 extends Players {
return
arr1
;
return
arr1
;
}
}
}
}
Players.java
View file @
8d5dfa55
...
@@ -110,13 +110,14 @@ public class Players {
...
@@ -110,13 +110,14 @@ public class Players {
}
}
/**
/**
*
* this method checks if the move is possible, then equalize the color of the
* @param arrOpponent
* player's disc in a line from the blank to the first player's disk that seen
* @param arr
* @param arrOpponent list of opponent discs' coordinates
* @param x
* @param arr list of the player disc's coordinates
* @param y
* @param x the x of the blank space
* @param moveX
* @param y the y of the blank space
* @param moveY
* @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
)
{
public
void
equalize
(
int
[][]
arrOpponent
,
int
[][]
arr
,
int
x
,
int
y
,
int
moveX
,
int
moveY
)
{
if
(
checkTheMoveIfPossible
(
arrOpponent
,
arr
,
x
,
y
,
moveX
,
moveY
))
{
if
(
checkTheMoveIfPossible
(
arrOpponent
,
arr
,
x
,
y
,
moveX
,
moveY
))
{
...
...
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