Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Pentago_9731301
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
9731301
Pentago_9731301
Commits
04b7356e
Commit
04b7356e
authored
Apr 07, 2020
by
9731301
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a method to User class to choose a winner
parent
17fe9228
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
202 additions
and
75 deletions
+202
-75
workspace.xml
.idea/workspace.xml
+42
-19
Block.class
out/production/MyPentago/Block.class
+0
-0
Pentago.class
out/production/MyPentago/Pentago.class
+0
-0
User.class
out/production/MyPentago/User.class
+0
-0
Block.java
src/Block.java
+1
-1
Pentago.java
src/Pentago.java
+51
-55
User.java
src/User.java
+108
-0
No files found.
.idea/workspace.xml
View file @
04b7356e
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"63729159-695b-4499-ba7f-f31e81a0234c"
name=
"Default Changelist"
comment=
""
>
<list
default=
"true"
id=
"63729159-695b-4499-ba7f-f31e81a0234c"
name=
"Default Changelist"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/MyPentago/Block.class"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/out/production/MyPentago/Block.class"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/MyPentago/Pentago.class"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/out/production/MyPentago/Pentago.class"
afterDir=
"false"
/>
</list>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
...
@@ -58,7 +60,10 @@
...
@@ -58,7 +60,10 @@
<workItem
from=
"1586099364327"
duration=
"87000"
/>
<workItem
from=
"1586099364327"
duration=
"87000"
/>
<workItem
from=
"1586105455800"
duration=
"97000"
/>
<workItem
from=
"1586105455800"
duration=
"97000"
/>
<workItem
from=
"1586105975356"
duration=
"8819000"
/>
<workItem
from=
"1586105975356"
duration=
"8819000"
/>
<workItem
from=
"1586162373379"
duration=
"6300000"
/>
<workItem
from=
"1586162373379"
duration=
"6530000"
/>
<workItem
from=
"1586174700430"
duration=
"9185000"
/>
<workItem
from=
"1586246845885"
duration=
"2399000"
/>
<workItem
from=
"1586261785897"
duration=
"13320000"
/>
</task>
</task>
<servers
/>
<servers
/>
</component>
</component>
...
@@ -66,45 +71,63 @@
...
@@ -66,45 +71,63 @@
<option
name=
"version"
value=
"1"
/>
<option
name=
"version"
value=
"1"
/>
</component>
</component>
<component
name=
"WindowStateProjectService"
>
<component
name=
"WindowStateProjectService"
>
<state
width=
"1493"
height=
"
2"
key=
"GridCell.Tab.0.bottom"
timestamp=
"1586168477737
"
>
<state
width=
"1493"
height=
"
564"
key=
"GridCell.Tab.0.bottom"
timestamp=
"1586275386382
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
</state>
<state
width=
"1493"
height=
"
2"
key=
"GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824"
timestamp=
"1586168477737
"
/>
<state
width=
"1493"
height=
"
564"
key=
"GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824"
timestamp=
"1586275386382
"
/>
<state
width=
"1493"
height=
"
2"
key=
"GridCell.Tab.0.center"
timestamp=
"1586168477737
"
>
<state
width=
"1493"
height=
"
564"
key=
"GridCell.Tab.0.center"
timestamp=
"1586275386382
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
</state>
<state
width=
"1493"
height=
"
2"
key=
"GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824"
timestamp=
"1586168477737
"
/>
<state
width=
"1493"
height=
"
564"
key=
"GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824"
timestamp=
"1586275386382
"
/>
<state
width=
"1493"
height=
"
2"
key=
"GridCell.Tab.0.left"
timestamp=
"1586168477737
"
>
<state
width=
"1493"
height=
"
564"
key=
"GridCell.Tab.0.left"
timestamp=
"1586275386382
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
</state>
<state
width=
"1493"
height=
"
2"
key=
"GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824"
timestamp=
"1586168477737
"
/>
<state
width=
"1493"
height=
"
564"
key=
"GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824"
timestamp=
"1586275386382
"
/>
<state
width=
"1493"
height=
"
2"
key=
"GridCell.Tab.0.right"
timestamp=
"1586168477737
"
>
<state
width=
"1493"
height=
"
564"
key=
"GridCell.Tab.0.right"
timestamp=
"1586275386382
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
</state>
<state
width=
"1493"
height=
"
2"
key=
"GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824"
timestamp=
"1586168477737
"
/>
<state
width=
"1493"
height=
"
564"
key=
"GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824"
timestamp=
"1586275386382
"
/>
<state
width=
"1493"
height=
"
358"
key=
"GridCell.Tab.1.bottom"
timestamp=
"1586168209278
"
>
<state
width=
"1493"
height=
"
194"
key=
"GridCell.Tab.1.bottom"
timestamp=
"1586274892633
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
</state>
<state
width=
"1493"
height=
"
358"
key=
"GridCell.Tab.1.bottom/0.0.1536.824@0.0.1536.824"
timestamp=
"1586168209278
"
/>
<state
width=
"1493"
height=
"
194"
key=
"GridCell.Tab.1.bottom/0.0.1536.824@0.0.1536.824"
timestamp=
"1586274892633
"
/>
<state
width=
"1493"
height=
"
358"
key=
"GridCell.Tab.1.center"
timestamp=
"1586168209278
"
>
<state
width=
"1493"
height=
"
194"
key=
"GridCell.Tab.1.center"
timestamp=
"1586274892633
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
</state>
<state
width=
"1493"
height=
"
358"
key=
"GridCell.Tab.1.center/0.0.1536.824@0.0.1536.824"
timestamp=
"1586168209278
"
/>
<state
width=
"1493"
height=
"
194"
key=
"GridCell.Tab.1.center/0.0.1536.824@0.0.1536.824"
timestamp=
"1586274892633
"
/>
<state
width=
"1493"
height=
"
358"
key=
"GridCell.Tab.1.left"
timestamp=
"1586168209278
"
>
<state
width=
"1493"
height=
"
194"
key=
"GridCell.Tab.1.left"
timestamp=
"1586274892633
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
</state>
<state
width=
"1493"
height=
"
358"
key=
"GridCell.Tab.1.left/0.0.1536.824@0.0.1536.824"
timestamp=
"1586168209278
"
/>
<state
width=
"1493"
height=
"
194"
key=
"GridCell.Tab.1.left/0.0.1536.824@0.0.1536.824"
timestamp=
"1586274892633
"
/>
<state
width=
"1493"
height=
"
358"
key=
"GridCell.Tab.1.right"
timestamp=
"1586168209278
"
>
<state
width=
"1493"
height=
"
194"
key=
"GridCell.Tab.1.right"
timestamp=
"1586274892633
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
</state>
<state
width=
"1493"
height=
"
358"
key=
"GridCell.Tab.1.right/0.0.1536.824@0.0.1536.824"
timestamp=
"1586168209278
"
/>
<state
width=
"1493"
height=
"
194"
key=
"GridCell.Tab.1.right/0.0.1536.824@0.0.1536.824"
timestamp=
"1586274892633
"
/>
<state
x=
"281"
y=
"271"
key=
"com.intellij.ide.util.TipDialog"
timestamp=
"1586
162378517
"
>
<state
x=
"281"
y=
"271"
key=
"com.intellij.ide.util.TipDialog"
timestamp=
"1586
261829792
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
</state>
<state
x=
"281"
y=
"271"
key=
"com.intellij.ide.util.TipDialog/0.0.1536.824@0.0.1536.824"
timestamp=
"1586
162378517
"
/>
<state
x=
"281"
y=
"271"
key=
"com.intellij.ide.util.TipDialog/0.0.1536.824@0.0.1536.824"
timestamp=
"1586
261829792
"
/>
<state
x=
"25"
y=
"67"
key=
"new project wizard"
timestamp=
"1586105483065"
>
<state
x=
"25"
y=
"67"
key=
"new project wizard"
timestamp=
"1586105483065"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
</state>
<state
x=
"25"
y=
"67"
key=
"new project wizard/0.0.1536.824@0.0.1536.824"
timestamp=
"1586105483065"
/>
<state
x=
"25"
y=
"67"
key=
"new project wizard/0.0.1536.824@0.0.1536.824"
timestamp=
"1586105483065"
/>
<state
x=
"425"
y=
"187"
key=
"run.anything.popup"
timestamp=
"1586180125854"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
x=
"425"
y=
"187"
key=
"run.anything.popup/0.0.1536.824@0.0.1536.824"
timestamp=
"1586180125854"
/>
</component>
<component
name=
"XDebuggerManager"
>
<breakpoint-manager>
<breakpoints>
<line-breakpoint
enabled=
"true"
type=
"java-method"
>
<url>
file://$PROJECT_DIR$/src/User.java
</url>
<line>
27
</line>
<properties
class=
"User"
method=
"isWinner"
>
<option
name=
"EMULATED"
value=
"true"
/>
</properties>
<option
name=
"timeStamp"
value=
"1"
/>
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
</component>
</project>
</project>
\ No newline at end of file
out/production/MyPentago/Block.class
View file @
04b7356e
No preview for this file type
out/production/MyPentago/Pentago.class
View file @
04b7356e
No preview for this file type
out/production/MyPentago/User.class
View file @
04b7356e
No preview for this file type
src/Block.java
View file @
04b7356e
...
@@ -41,7 +41,7 @@ public class Block {
...
@@ -41,7 +41,7 @@ public class Block {
allCells
.
remove
(
6
);
allCells
.
remove
(
6
);
allCells
.
add
(
8
,
allCells
.
get
(
0
));
allCells
.
add
(
8
,
allCells
.
get
(
0
));
allCells
.
remove
(
8
);
allCells
.
remove
(
0
);
allCells
.
add
(
0
,
allCells
.
get
(
8
));
allCells
.
add
(
0
,
allCells
.
get
(
8
));
allCells
.
remove
(
9
);
allCells
.
remove
(
9
);
...
...
src/Pentago.java
View file @
04b7356e
...
@@ -10,10 +10,12 @@ public class Pentago {
...
@@ -10,10 +10,12 @@ public class Pentago {
User
chosenUser
=
new
User
();
User
chosenUser
=
new
User
();
chosenUser
=
user2
;
chosenUser
=
user2
;
user1
.
setColor
(
'⚫'
);
user1
.
setColor
(
'⚫'
);
user2
.
setColor
(
'
m
'
);
user2
.
setColor
(
'
0
'
);
int
blockNumber
;
int
blockNumber
;
int
cellNumber
;
int
cellNumber
;
int
i
,
j
;
int
blockNumberToTurn
;
int
i
;
boolean
ans
=
false
;
String
turn
;
String
turn
;
for
(
i
=
0
;
i
<
4
;
i
++
){
for
(
i
=
0
;
i
<
4
;
i
++
){
Block
block
=
new
Block
();
Block
block
=
new
Block
();
...
@@ -21,7 +23,54 @@ public class Pentago {
...
@@ -21,7 +23,54 @@ public class Pentago {
block
.
setNumber
(
i
);
block
.
setNumber
(
i
);
blocks
.
add
(
block
);
blocks
.
add
(
block
);
}
}
printBlocks
(
blocks
);
while
(
true
)
{
if
(
chosenUser
.
isWinner
(
blocks
)){
System
.
out
.
println
(
chosenUser
.
getColor
()
+
" is winner"
);
break
;
}
//pass the turn if there is not any cell to choose for player
if
(
chosenUser
.
equals
(
user1
)){
chosenUser
=
user2
;
}
else
{
chosenUser
=
user1
;
}
//if there is not any cell to choose foe chosen user
for
(
Block
b
:
blocks
){
for
(
int
k
=
0
;
k
<
9
;
k
++)
{
if
(
b
.
getAllCells
().
get
(
k
).
getColor
().
equals
(
'O'
))
{
ans
=
true
;
break
;
}
}
}
if
(
ans
==
false
){
System
.
out
.
println
(
"pass"
);
continue
;
}
System
.
out
.
println
(
"\nplz enter a block number"
);
blockNumber
=
scanner
.
nextInt
()
-
1
;
System
.
out
.
println
(
"plz enter a cell number"
);
cellNumber
=
scanner
.
nextInt
()
-
1
;
if
(
chosenUser
.
cellIsAvailableToTake
(
blocks
.
get
(
blockNumber
).
getAllCells
().
get
(
cellNumber
)))
{
blocks
.
get
(
blockNumber
).
getAllCells
().
get
(
cellNumber
).
setColor
(
chosenUser
.
getColor
());
}
printBlocks
(
blocks
);
System
.
out
.
println
();
System
.
out
.
println
(
"plz enter the number of block you wanna turn"
);
blockNumberToTurn
=
scanner
.
nextInt
()
-
1
;
System
.
out
.
println
(
"plz enter how change position? right/left"
);
turn
=
scanner
.
next
().
trim
();
blocks
.
get
(
blockNumberToTurn
).
changePositionOfBlock
(
turn
);
printBlocks
(
blocks
);
}
}
public
static
void
printBlocks
(
ArrayList
<
Block
>
blocks
){
int
i
,
j
;
j
=
0
;
j
=
0
;
for
(
i
=
0
;
i
<
4
;){
for
(
i
=
0
;
i
<
4
;){
System
.
out
.
print
(
"| "
+
blocks
.
get
(
i
).
getAllCells
().
get
(
j
++).
getColor
()+
" "
+
blocks
.
get
(
i
).
getAllCells
().
get
(
j
++).
getColor
()
+
" "
+
blocks
.
get
(
i
).
getAllCells
().
get
(
j
++).
getColor
()
+
" |"
);
System
.
out
.
print
(
"| "
+
blocks
.
get
(
i
).
getAllCells
().
get
(
j
++).
getColor
()+
" "
+
blocks
.
get
(
i
).
getAllCells
().
get
(
j
++).
getColor
()
+
" "
+
blocks
.
get
(
i
).
getAllCells
().
get
(
j
++).
getColor
()
+
" |"
);
...
@@ -51,58 +100,5 @@ public class Pentago {
...
@@ -51,58 +100,5 @@ public class Pentago {
System
.
out
.
println
();
System
.
out
.
println
();
}
}
}
}
while
(
true
)
{
if
(
chosenUser
.
equals
(
user1
)){
chosenUser
=
user2
;
}
else
{
chosenUser
=
user1
;
}
System
.
out
.
println
(
"\nplz enter a block number"
);
blockNumber
=
scanner
.
nextInt
()-
1
;
System
.
out
.
println
(
"plz enter a cell number"
);
cellNumber
=
scanner
.
nextInt
()-
1
;
if
(
chosenUser
.
cellIsAvailableToTake
(
blocks
.
get
(
blockNumber
).
getAllCells
().
get
(
cellNumber
)))
{
blocks
.
get
(
blockNumber
).
getAllCells
().
get
(
cellNumber
).
setColor
(
chosenUser
.
getColor
());
System
.
out
.
println
(
blocks
.
get
(
blockNumber
).
getAllCells
().
get
(
cellNumber
).
getColor
());
}
// System.out.println("plz enter how change position? right/left");
// turn = scanner.next().trim();
// blocks.get(blockNumber).changePositionOfBlock(turn);
j
=
0
;
i
=
0
;
System
.
out
.
println
(
blocks
.
get
(
i
).
getAllCells
().
get
(
j
++).
getColor
()+
" "
+
blocks
.
get
(
i
).
getAllCells
().
get
(
j
++).
getColor
());
j
=
0
;
for
(
i
=
0
;
i
<
4
;){
System
.
out
.
print
(
"| "
+
blocks
.
get
(
i
).
getAllCells
().
get
(
j
++).
getColor
()+
" "
+
blocks
.
get
(
i
).
getAllCells
().
get
(
j
++).
getColor
()
+
" "
+
blocks
.
get
(
i
).
getAllCells
().
get
(
j
++).
getColor
()
+
" |"
);
if
(
i
==
3
&&
j
==
9
){
break
;
}
if
((
i
==
0
||
i
==
2
)
&&
j
==
3
){
i
++;
j
=
0
;
}
else
if
((
i
==
0
||
i
==
2
)
&&
j
==
6
){
i
++;
j
=
3
;
}
else
if
((
i
==
0
||
i
==
2
)
&&
j
==
9
){
i
++;
j
=
6
;
}
else
if
((
i
==
1
)&&
j
==
9
){
i
=
2
;
j
=
0
;
System
.
out
.
println
(
"\n------------------"
);
continue
;
}
else
if
(
(
j
==
3
||
j
==
6
)
&&
(
i
==
1
||
i
==
3
)){
i
--;
System
.
out
.
println
();
}
}
}
}
}
}
}
src/User.java
View file @
04b7356e
...
@@ -24,4 +24,112 @@ public class User {
...
@@ -24,4 +24,112 @@ public class User {
public
void
setColor
(
Character
color
)
{
public
void
setColor
(
Character
color
)
{
this
.
color
=
color
;
this
.
color
=
color
;
}
}
public
boolean
isWinner
(
ArrayList
<
Block
>
blocks
){
//choose the winner
int
counter
=
0
;
for
(
int
cellIndex
=
0
,
blockIndex
=
0
;
counter
<
12
;
){
// checking horizental
if
(
blocks
.
get
(
blockIndex
).
getAllCells
().
get
(
cellIndex
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
blockIndex
).
getAllCells
().
get
(
cellIndex
+
1
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
blockIndex
).
getAllCells
().
get
(
cellIndex
+
2
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
blockIndex
+
1
).
getAllCells
().
get
(
cellIndex
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
blockIndex
+
1
).
getAllCells
().
get
(
cellIndex
+
1
).
getColor
().
equals
(
color
)){
return
true
;
}
counter
++
;
if
(
counter
==
3
||
counter
==
9
){
blockIndex
=
2
;
}
if
(
counter
==
6
){
cellIndex
=
1
;
blockIndex
=
0
;
}
}
counter
=
0
;
for
(
int
cellIndex
=
0
,
blockIndex
=
0
;
counter
<
12
;
){
// checking vertical
if
(
blocks
.
get
(
blockIndex
).
getAllCells
().
get
(
cellIndex
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
blockIndex
).
getAllCells
().
get
(
cellIndex
+
3
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
blockIndex
).
getAllCells
().
get
(
cellIndex
+
6
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
blockIndex
+
2
).
getAllCells
().
get
(
cellIndex
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
blockIndex
+
2
).
getAllCells
().
get
(
cellIndex
+
3
).
getColor
().
equals
(
color
)){
return
true
;
}
counter
++
;
if
(
counter
==
3
||
counter
==
9
){
blockIndex
=
1
;
}
if
(
counter
==
6
){
blockIndex
=
0
;
cellIndex
=
1
;
}
}
//check diagonal
if
(
blocks
.
get
(
1
).
getAllCells
().
get
(
1
).
equals
(
color
)
&&
blocks
.
get
(
1
).
getAllCells
().
get
(
3
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
2
).
getAllCells
().
get
(
1
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
2
).
getAllCells
().
get
(
3
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
0
).
getAllCells
().
get
(
8
).
getColor
().
equals
(
color
)){
return
true
;
}
if
(
blocks
.
get
(
1
).
getAllCells
().
get
(
2
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
1
).
getAllCells
().
get
(
4
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
1
).
getAllCells
().
get
(
6
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
2
).
getAllCells
().
get
(
2
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
2
).
getAllCells
().
get
(
4
).
getColor
().
equals
(
color
)){
return
true
;
}
if
(
blocks
.
get
(
1
).
getAllCells
().
get
(
4
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
1
).
getAllCells
().
get
(
6
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
2
).
getAllCells
().
get
(
2
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
2
).
getAllCells
().
get
(
4
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
2
).
getAllCells
().
get
(
6
).
getColor
().
equals
(
color
)){
return
true
;
}
if
(
blocks
.
get
(
1
).
getAllCells
().
get
(
5
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
1
).
getAllCells
().
get
(
7
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
3
).
getAllCells
().
get
(
5
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
3
).
getAllCells
().
get
(
7
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
3
).
getAllCells
().
get
(
0
).
getColor
().
equals
(
color
)){
return
true
;
}
if
(
blocks
.
get
(
0
).
getAllCells
().
get
(
0
).
equals
(
color
)
&&
blocks
.
get
(
0
).
getAllCells
().
get
(
4
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
0
).
getAllCells
().
get
(
8
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
3
).
getAllCells
().
get
(
0
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
3
).
getAllCells
().
get
(
4
).
getColor
().
equals
(
color
)){
return
true
;
}
if
(
blocks
.
get
(
0
).
getAllCells
().
get
(
1
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
0
).
getAllCells
().
get
(
5
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
1
).
getAllCells
().
get
(
6
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
3
).
getAllCells
().
get
(
1
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
3
).
getAllCells
().
get
(
5
).
getColor
().
equals
(
color
)){
return
true
;
}
if
(
blocks
.
get
(
0
).
getAllCells
().
get
(
3
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
0
).
getAllCells
().
get
(
7
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
2
).
getAllCells
().
get
(
2
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
3
).
getAllCells
().
get
(
3
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
3
).
getAllCells
().
get
(
7
).
getColor
().
equals
(
color
)){
return
true
;
}
if
(
blocks
.
get
(
0
).
getAllCells
().
get
(
4
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
0
).
getAllCells
().
get
(
8
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
3
).
getAllCells
().
get
(
0
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
3
).
getAllCells
().
get
(
4
).
getColor
().
equals
(
color
)
&&
blocks
.
get
(
3
).
getAllCells
().
get
(
8
).
getColor
().
equals
(
color
)){
return
true
;
}
return
false
;
}
}
}
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