Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
O
Othello_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
Othello_9731301
Commits
b95e5b9d
Commit
b95e5b9d
authored
Apr 01, 2020
by
9731301
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add calculations the winner Othello class
parent
afc1cdc2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
391 additions
and
47 deletions
+391
-47
workspace.xml
.idea/workspace.xml
+31
-21
Othello.class
out/production/MyOthello/Othello.class
+0
-0
User.class
out/production/MyOthello/User.class
+0
-0
Othello.java
src/Othello.java
+329
-14
User.java
src/User.java
+31
-12
No files found.
.idea/workspace.xml
View file @
b95e5b9d
...
...
@@ -2,6 +2,10 @@
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"7be08370-19a4-4528-ab9b-d4cb0ec736c4"
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$/out/production/MyOthello/Othello.class"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/out/production/MyOthello/Othello.class"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/MyOthello/User.class"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/out/production/MyOthello/User.class"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/Othello.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/Othello.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/User.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/User.java"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
...
...
@@ -60,7 +64,9 @@
<workItem
from=
"1585656097487"
duration=
"2378000"
/>
<workItem
from=
"1585659438353"
duration=
"9321000"
/>
<workItem
from=
"1585687211713"
duration=
"16102000"
/>
<workItem
from=
"1585733466673"
duration=
"3956000"
/>
<workItem
from=
"1585733466673"
duration=
"4235000"
/>
<workItem
from=
"1585743679588"
duration=
"17656000"
/>
<workItem
from=
"1585769658377"
duration=
"6434000"
/>
</task>
<servers
/>
</component>
...
...
@@ -68,45 +74,49 @@
<option
name=
"version"
value=
"1"
/>
</component>
<component
name=
"WindowStateProjectService"
>
<state
x=
"574"
y=
"97"
key=
"#com.intellij.ide.util.MemberChooser"
timestamp=
"15857
36657332
"
>
<state
x=
"574"
y=
"97"
key=
"#com.intellij.ide.util.MemberChooser"
timestamp=
"15857
72436513
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
x=
"574"
y=
"97"
key=
"#com.intellij.ide.util.MemberChooser/0.0.1536.824@0.0.1536.824"
timestamp=
"15857
36657332
"
/>
<state
width=
"1493"
height=
"
250"
key=
"GridCell.Tab.0.bottom"
timestamp=
"1585738348489
"
>
<state
x=
"574"
y=
"97"
key=
"#com.intellij.ide.util.MemberChooser/0.0.1536.824@0.0.1536.824"
timestamp=
"15857
72436513
"
/>
<state
width=
"1493"
height=
"
63"
key=
"GridCell.Tab.0.bottom"
timestamp=
"1585776104986
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1493"
height=
"
250"
key=
"GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824"
timestamp=
"1585738348489
"
/>
<state
width=
"1493"
height=
"
250"
key=
"GridCell.Tab.0.center"
timestamp=
"1585738348488
"
>
<state
width=
"1493"
height=
"
63"
key=
"GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824"
timestamp=
"1585776104986
"
/>
<state
width=
"1493"
height=
"
63"
key=
"GridCell.Tab.0.center"
timestamp=
"1585776104985
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1493"
height=
"
250"
key=
"GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824"
timestamp=
"1585738348488
"
/>
<state
width=
"1493"
height=
"
250"
key=
"GridCell.Tab.0.left"
timestamp=
"1585738348488
"
>
<state
width=
"1493"
height=
"
63"
key=
"GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824"
timestamp=
"1585776104985
"
/>
<state
width=
"1493"
height=
"
63"
key=
"GridCell.Tab.0.left"
timestamp=
"1585776104985
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1493"
height=
"
250"
key=
"GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824"
timestamp=
"1585738348488
"
/>
<state
width=
"1493"
height=
"
250"
key=
"GridCell.Tab.0.right"
timestamp=
"1585738348488
"
>
<state
width=
"1493"
height=
"
63"
key=
"GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824"
timestamp=
"1585776104985
"
/>
<state
width=
"1493"
height=
"
63"
key=
"GridCell.Tab.0.right"
timestamp=
"1585776104985
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1493"
height=
"
250"
key=
"GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824"
timestamp=
"1585738348488
"
/>
<state
width=
"1493"
height=
"
182"
key=
"GridCell.Tab.1.bottom"
timestamp=
"1585671521268
"
>
<state
width=
"1493"
height=
"
63"
key=
"GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824"
timestamp=
"1585776104985
"
/>
<state
width=
"1493"
height=
"
331"
key=
"GridCell.Tab.1.bottom"
timestamp=
"1585762030361
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1493"
height=
"
182"
key=
"GridCell.Tab.1.bottom/0.0.1536.824@0.0.1536.824"
timestamp=
"1585671521268
"
/>
<state
width=
"1493"
height=
"
182"
key=
"GridCell.Tab.1.center"
timestamp=
"1585671521268
"
>
<state
width=
"1493"
height=
"
331"
key=
"GridCell.Tab.1.bottom/0.0.1536.824@0.0.1536.824"
timestamp=
"1585762030361
"
/>
<state
width=
"1493"
height=
"
331"
key=
"GridCell.Tab.1.center"
timestamp=
"1585762030361
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1493"
height=
"
182"
key=
"GridCell.Tab.1.center/0.0.1536.824@0.0.1536.824"
timestamp=
"1585671521268
"
/>
<state
width=
"1493"
height=
"
182"
key=
"GridCell.Tab.1.left"
timestamp=
"1585671521267
"
>
<state
width=
"1493"
height=
"
331"
key=
"GridCell.Tab.1.center/0.0.1536.824@0.0.1536.824"
timestamp=
"1585762030361
"
/>
<state
width=
"1493"
height=
"
331"
key=
"GridCell.Tab.1.left"
timestamp=
"1585762030361
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1493"
height=
"
182"
key=
"GridCell.Tab.1.left/0.0.1536.824@0.0.1536.824"
timestamp=
"1585671521267
"
/>
<state
width=
"1493"
height=
"
182"
key=
"GridCell.Tab.1.right"
timestamp=
"1585671521268
"
>
<state
width=
"1493"
height=
"
331"
key=
"GridCell.Tab.1.left/0.0.1536.824@0.0.1536.824"
timestamp=
"1585762030361
"
/>
<state
width=
"1493"
height=
"
331"
key=
"GridCell.Tab.1.right"
timestamp=
"1585762030361
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1493"
height=
"
182"
key=
"GridCell.Tab.1.right/0.0.1536.824@0.0.1536.824"
timestamp=
"1585671521268
"
/>
<state
x=
"813"
y=
"283"
key=
"com.intellij.ide.util.TipDialog"
timestamp=
"15857
3347164
5"
>
<state
width=
"1493"
height=
"
331"
key=
"GridCell.Tab.1.right/0.0.1536.824@0.0.1536.824"
timestamp=
"1585762030361
"
/>
<state
x=
"813"
y=
"283"
key=
"com.intellij.ide.util.TipDialog"
timestamp=
"15857
6971102
5"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
x=
"813"
y=
"283"
key=
"com.intellij.ide.util.TipDialog/0.0.1536.824@0.0.1536.824"
timestamp=
"1585733471645"
/>
<state
x=
"813"
y=
"283"
key=
"com.intellij.ide.util.TipDialog/0.0.1536.824@0.0.1536.824"
timestamp=
"1585769711025"
/>
<state
x=
"431"
y=
"145"
width=
"672"
height=
"678"
key=
"search.everywhere.popup"
timestamp=
"1585744923229"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
x=
"431"
y=
"145"
width=
"672"
height=
"678"
key=
"search.everywhere.popup/0.0.1536.824@0.0.1536.824"
timestamp=
"1585744923229"
/>
</component>
</project>
\ No newline at end of file
out/production/MyOthello/Othello.class
View file @
b95e5b9d
No preview for this file type
out/production/MyOthello/User.class
View file @
b95e5b9d
No preview for this file type
src/Othello.java
View file @
b95e5b9d
This diff is collapsed.
Click to expand it.
src/User.java
View file @
b95e5b9d
...
...
@@ -14,9 +14,13 @@ public class User {
userBlocks
.
add
(
block
);
}
public
void
removeBlock
(
Block
block
){
userBlocks
.
remove
(
block
);
}
public
boolean
isAvailableBlockToPick
(
Block
block
,
ArrayList
<
Block
>
blocks
)
{
int
i
,
j
;
int
flag1
=
0
;
int
flag1
=
0
;
// for checking neighbors has same color in each step or not
int
flag2
=
0
;
int
flag3
=
0
;
// to know you can pick an empty block with help of checking changing color
if
(!
block
.
getColor
().
equals
(
'n'
))
{
...
...
@@ -26,7 +30,7 @@ public class User {
//check down
for
(
i
=
block
.
getRow
();
i
>
8
;
i
++)
{
// find the next block with chosen block color
for
(
Block
block1
:
blocks
)
{
if
(
block1
.
get
Row
()
==
block
.
getRow
()
+
1
&&
block1
.
getColor
().
equals
(
color
))
{
if
(
block1
.
get
Column
()
==
block
.
getColumn
()
&&
block1
.
getRow
()
==
block
.
getRow
()
+
1
&&
(
block1
.
getColor
().
equals
(
color
)
||
block1
.
getColor
().
equals
(
'n'
)
))
{
flag1
=
1
;
break
;
}
...
...
@@ -46,9 +50,9 @@ public class User {
//check up
flag1
=
0
;
flag2
=
0
;
for
(
i
=
block
.
getRow
()
-
1
;
i
>
=
0
;
i
--)
{
// find the next block with chosen block color
for
(
i
=
block
.
getRow
()
-
1
;
i
>
-
1
;
i
--)
{
// find the next block with chosen block color
for
(
Block
block1
:
blocks
)
{
if
(
block1
.
getRow
()
==
block
.
getRow
()
-
1
&&
block1
.
getColumn
()
==
block
.
getColumn
()
&&
block1
.
getColor
().
equals
(
color
))
{
if
(
block1
.
getRow
()
==
block
.
getRow
()
-
1
&&
block1
.
getColumn
()
==
block
.
getColumn
()
&&
(
block1
.
getColor
().
equals
(
color
)
||
block1
.
getColor
().
equals
(
'n'
)
))
{
flag1
=
1
;
break
;
}
...
...
@@ -70,7 +74,7 @@ public class User {
flag2
=
0
;
for
(
i
=
block
.
getColumn
()
+
1
;
i
<
8
;
i
++)
{
// find the next block with chosen block color
for
(
Block
block1
:
blocks
)
{
if
(
block1
.
getColumn
()
==
block
.
getColumn
()
+
1
&&
block1
.
getRow
()
==
block
.
getRow
()
&&
block1
.
getColor
().
equals
(
color
))
{
if
(
block1
.
getColumn
()
==
block
.
getColumn
()
+
1
&&
block1
.
getRow
()
==
block
.
getRow
()
&&
(
block1
.
getColor
().
equals
(
color
)
||
block1
.
getColor
().
equals
(
'n'
)
))
{
flag1
=
1
;
break
;
}
...
...
@@ -90,9 +94,9 @@ public class User {
//check left
flag1
=
0
;
flag2
=
0
;
for
(
i
=
block
.
getColumn
()
-
1
;
i
>
=
0
;
i
--)
{
// find the next block with chosen block color
for
(
i
=
block
.
getColumn
()
-
1
;
i
>
-
1
;
i
--)
{
// find the next block with chosen block color
for
(
Block
block1
:
blocks
)
{
if
(
block1
.
getColumn
()
==
block
.
getColumn
()
-
1
&&
block1
.
getRow
()
==
block
.
getRow
()
&&
block1
.
getColor
().
equals
(
color
))
{
if
(
block1
.
getColumn
()
==
block
.
getColumn
()
-
1
&&
block1
.
getRow
()
==
block
.
getRow
()
&&
(
block1
.
getColor
().
equals
(
color
)
||
block1
.
getColor
().
equals
(
'n'
)
))
{
flag1
=
1
;
break
;
}
...
...
@@ -115,7 +119,7 @@ public class User {
flag2
=
0
;
for
(
i
=
block
.
getColumn
()
+
1
,
j
=
block
.
getRow
()
-
1
;
i
<
8
&&
j
>
-
1
;
i
++,
j
--)
{
// find the next block with chosen block color
for
(
Block
block1
:
blocks
)
{
if
(
block1
.
getColumn
()
==
block
.
getColumn
()
+
1
&&
block1
.
getRow
()
==
block
.
getRow
()
+
1
&&
block1
.
getColor
().
equals
(
color
))
{
if
(
block1
.
getColumn
()
==
block
.
getColumn
()
+
1
&&
block1
.
getRow
()
==
block
.
getRow
()
+
1
&&
(
block1
.
getColor
().
equals
(
color
)
||
block1
.
getColor
().
equals
(
'n'
)
))
{
flag1
=
1
;
break
;
}
...
...
@@ -137,7 +141,7 @@ public class User {
flag2
=
0
;
for
(
i
=
block
.
getColumn
()
-
1
,
j
=
block
.
getRow
()
+
1
;
i
>
-
1
&&
j
<
8
;
i
--,
j
++)
{
// find the next block with chosen block color
for
(
Block
block1
:
blocks
)
{
if
(
block1
.
getColumn
()
==
block
.
getColumn
()
-
1
&&
block1
.
getRow
()
==
block
.
getRow
()
+
1
&&
block1
.
getColor
().
equals
(
color
))
{
if
(
block1
.
getColumn
()
==
block
.
getColumn
()
-
1
&&
block1
.
getRow
()
==
block
.
getRow
()
+
1
&&
(
block1
.
getColor
().
equals
(
color
)
||
block1
.
getColor
().
equals
(
'n'
)
))
{
flag1
=
1
;
break
;
}
...
...
@@ -159,7 +163,7 @@ public class User {
flag2
=
0
;
for
(
i
=
block
.
getColumn
()
+
1
,
j
=
block
.
getRow
()
+
1
;
i
<
8
&&
j
<
8
;
i
++,
j
++)
{
// find the next block with chosen block color
for
(
Block
block1
:
blocks
)
{
if
(
block1
.
getColumn
()
==
block
.
getColumn
()
+
1
&&
block1
.
getRow
()
==
block
.
getRow
()
-
1
&&
block1
.
getColor
().
equals
(
color
))
{
if
(
block1
.
getColumn
()
==
block
.
getColumn
()
+
1
&&
block1
.
getRow
()
==
block
.
getRow
()
-
1
&&
(
block1
.
getColor
().
equals
(
color
)
||
block1
.
getColor
().
equals
(
'n'
)
))
{
flag1
=
1
;
break
;
}
...
...
@@ -179,9 +183,9 @@ public class User {
//check up and left
flag1
=
0
;
flag2
=
0
;
for
(
i
=
block
.
getColumn
()
-
1
,
j
=
block
.
getRow
()
-
1
;
i
<
-
1
&&
j
<
-
1
;
i
--,
j
--)
{
// find the next block with chosen block color
for
(
i
=
block
.
getColumn
()
-
1
,
j
=
block
.
getRow
()
-
1
;
i
>
-
1
&&
j
>
-
1
;
i
--,
j
--)
{
// find the next block with chosen block color
for
(
Block
block1
:
blocks
)
{
if
(
block1
.
getColumn
()
==
block
.
getColumn
()
-
1
&&
block1
.
getRow
()
==
block
.
getRow
()
-
1
&&
block1
.
getColor
().
equals
(
color
))
{
if
(
block1
.
getColumn
()
==
block
.
getColumn
()
-
1
&&
block1
.
getRow
()
==
block
.
getRow
()
-
1
&&
(
block1
.
getColor
().
equals
(
color
)
||
block1
.
getColor
().
equals
(
'n'
)
))
{
flag1
=
1
;
break
;
}
...
...
@@ -238,5 +242,20 @@ public class User {
this
.
name
=
name
;
}
public
ArrayList
<
Block
>
getAvailableBlocksToPick
()
{
return
availableBlocksToPick
;
}
public
void
setAvailableBlocksToPick
(
ArrayList
<
Block
>
availableBlocksToPick
)
{
this
.
availableBlocksToPick
=
availableBlocksToPick
;
}
public
ArrayList
<
Block
>
getUserBlocks
()
{
return
userBlocks
;
}
public
void
setUserBlocks
(
ArrayList
<
Block
>
userBlocks
)
{
this
.
userBlocks
=
userBlocks
;
}
}
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