Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
project2pentago
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
project2pentago
Commits
e25994ec
Commit
e25994ec
authored
Apr 03, 2020
by
amir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
huge changes!!
parent
2bf341fa
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
120 additions
and
2 deletions
+120
-2
Player.java
Player.java
+84
-0
Player1.java
Player1.java
+4
-0
Player2.java
Player2.java
+4
-0
smallBoards.java
smallBoards.java
+28
-2
No files found.
Player.java
0 → 100644
View file @
e25994ec
package
com
.
company
;
public
class
Player
{
private
int
[][]
playerCoordinate
;
public
Player
(){
playerCoordinate
=
new
int
[
6
][
6
];
}
public
int
[][]
getPlayerCoordinate
()
{
return
playerCoordinate
;
}
public
boolean
containsInArray
(
int
[][]
arr
,
int
x
,
int
y
){
if
(
arr
[
x
][
y
]
!=
0
)
return
true
;
else
return
false
;
}
public
void
addDisc
(
int
[][]
arr
,
int
[][]
arrOpponent
,
int
x
,
int
y
){
if
((!
containsInArray
(
arr
,
x
,
y
))
&&
(!
containsInArray
(
arrOpponent
,
x
,
y
)))
arr
[
x
][
y
]++;
}
public
boolean
searchIfMatchEnds
(
int
[][]
arr
,
int
[][]
arrOpponent
){
for
(
int
i
=
0
;
i
<
6
;
i
++){
for
(
int
j
=
0
;
j
<
6
;
j
++){
if
(
containsInArray
(
arr
,
j
,
i
)){
}
}
}
}
public
void
checkSides
(
int
[][]
arr
,
int
x
,
int
y
){
if
(
x
!=
0
){
if
(
containsInArray
(
arr
,
x
-
1
,
y
)){
if
(
checkTheMoveIfPossible
(
arrOpponent
,
arr
,
x
,
y
,
-
1
,
0
))
}
if
(
y
!=
0
){
if
(
containsInArray
(
arr
,
x
-
1
,
y
-
1
))
if
(
checkTheMoveIfPossible
(
arrOpponent
,
arr
,
x
,
y
,
-
1
,
-
1
))
return
true
;
}
if
(
y
!=
5
){
if
(
containsInArray
(
arr
,
x
-
1
,
y
+
1
))
if
(
checkTheMoveIfPossible
(
arrOpponent
,
arr
,
x
,
y
,
-
1
,
+
1
))
return
true
;
}
}
if
(
x
!=
5
){
if
(
containsInArray
(
arrOpponent
,
x
+
1
,
y
)){
if
(
checkTheMoveIfPossible
(
arrOpponent
,
arr
,
x
,
y
,
+
1
,
0
))
return
true
;
}
if
(
y
!=
0
){
if
(
containsInArray
(
arrOpponent
,
x
+
1
,
y
-
1
))
if
(
checkTheMoveIfPossible
(
arrOpponent
,
arr
,
x
,
y
,
+
1
,
-
1
))
return
true
;
}
if
(
y
!=
5
){
if
(
containsInArray
(
arrOpponent
,
x
+
1
,
y
+
1
))
{
if
(
checkTheMoveIfPossible
(
arrOpponent
,
arr
,
x
,
y
,
+
1
,
+
1
))
return
true
;
}
}
}
if
(
y
!=
0
){
if
(
containsInArray
(
arrOpponent
,
x
,
y
-
1
))
if
(
checkTheMoveIfPossible
(
arrOpponent
,
arr
,
x
,
y
,
0
,
-
1
))
return
true
;
}
if
(
y
!=
5
){
if
(
containsInArray
(
arrOpponent
,
x
,
y
+
1
))
{
if
(
checkTheMoveIfPossible
(
arrOpponent
,
arr
,
x
,
y
,
0
,
+
1
))
return
true
;
}
}
return
false
;
}
}
Player1.java
0 → 100644
View file @
e25994ec
package
com
.
company
;
public
class
Player1
extends
Player
{
}
Player2.java
0 → 100644
View file @
e25994ec
package
com
.
company
;
public
class
Player2
extends
Player
{
}
smallBoards.java
View file @
e25994ec
...
...
@@ -13,9 +13,35 @@ public class smallBoards {
if
((
x
>=
3
)
&&
(
x
<
6
)
&&
(
y
>=
0
)
&&
(
y
<
3
))
return
2
;
if
((
x
>=
0
)
&&
(
x
<
3
)
&&
(
y
>=
3
)
&&
(
y
<
6
))
return
1
;
return
3
;
if
((
x
>=
3
)
&&
(
x
<
6
)
&&
(
y
>=
3
)
&&
(
y
<
6
))
return
4
;
return
12
;
return
0
;
}
public
int
rotate
(
int
boardNumber
){
int
tmp
=
boardsCoordinate
[
2
][
0
];
boardsCoordinate
[
2
][
0
]
=
boardsCoordinate
[
0
][
0
];
int
tmp1
=
boardsCoordinate
[
2
][
2
];
boardsCoordinate
[
2
][
2
]
=
tmp
;
int
tmp2
=
boardsCoordinate
[
0
][
2
];
boardsCoordinate
[
0
][
2
]
=
tmp1
;
boardsCoordinate
[
0
][
0
]
=
tmp2
;
int
tmp3
=
boardsCoordinate
[
1
][
0
];
boardsCoordinate
[
1
][
0
]
=
boardsCoordinate
[
0
][
1
];
int
tmp4
=
boardsCoordinate
[
2
][
1
];
boardsCoordinate
[
2
][
1
]
=
tmp3
;
int
tmp5
=
boardsCoordinate
[
1
][
2
];
boardsCoordinate
[
1
][
2
]
=
tmp4
;
boardsCoordinate
[
0
][
1
]
=
tmp5
;
return
boardNumber
;
}
public
void
addDiscToTheBoard
(
int
x
,
int
y
,
int
playerNumber
){
if
(
boardsCoordinate
[
x
][
y
]
==
0
)
boardsCoordinate
[
x
][
y
]
=
playerNumber
;
}
}
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