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
e19b199d
Commit
e19b199d
authored
Apr 01, 2020
by
9731301
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add User class
parent
3c6038f1
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
312 additions
and
4 deletions
+312
-4
vcs.xml
.idea/vcs.xml
+7
-0
workspace.xml
.idea/workspace.xml
+70
-1
Block.class
out/production/MyOthello/Block.class
+0
-0
Othello.class
out/production/MyOthello/Othello.class
+0
-0
User.class
out/production/MyOthello/User.class
+0
-0
Block.java
src/Block.java
+3
-3
User.java
src/User.java
+232
-0
No files found.
.idea/vcs.xml
0 → 100644
View file @
e19b199d
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
""
vcs=
"Git"
/>
<mapping
directory=
"$PROJECT_DIR$/src"
vcs=
"Git"
/>
</component>
</project>
\ No newline at end of file
.idea/workspace.xml
View file @
e19b199d
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"7be08370-19a4-4528-ab9b-d4cb0ec736c4"
name=
"Default Changelist"
comment=
""
/>
<list
default=
"true"
id=
"7be08370-19a4-4528-ab9b-d4cb0ec736c4"
name=
"Default Changelist"
comment=
""
>
<change
afterPath=
"$PROJECT_DIR$/.idea/vcs.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/User.java"
beforeDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
...
...
@@ -14,7 +18,11 @@
</list>
</option>
</component>
<component
name=
"Git.Settings"
>
<option
name=
"RECENT_GIT_ROOT_PATH"
value=
"$PROJECT_DIR$/src"
/>
</component>
<component
name=
"ProjectId"
id=
"1Zsmu4mM7KcQDh52oJP40I8FmWM"
/>
<component
name=
"ProjectLevelVcsManager"
settingsEditedManually=
"true"
/>
<component
name=
"ProjectViewState"
>
<option
name=
"hideEmptyMiddlePackages"
value=
"true"
/>
<option
name=
"showExcludedFiles"
value=
"true"
/>
...
...
@@ -22,9 +30,24 @@
</component>
<component
name=
"PropertiesComponent"
>
<property
name=
"RunOnceActivity.ShowReadmeOnStart"
value=
"true"
/>
<property
name=
"SHARE_PROJECT_CONFIGURATION_FILES"
value=
"true"
/>
<property
name=
"WebServerToolWindowFactoryState"
value=
"false"
/>
<property
name=
"aspect.path.notification.shown"
value=
"true"
/>
</component>
<component
name=
"RunManager"
>
<configuration
name=
"Othello"
type=
"Application"
factoryName=
"Application"
temporary=
"true"
nameIsGenerated=
"true"
>
<option
name=
"MAIN_CLASS_NAME"
value=
"Othello"
/>
<module
name=
"MyOthello"
/>
<method
v=
"2"
>
<option
name=
"Make"
enabled=
"true"
/>
</method>
</configuration>
<recent_temporary>
<list>
<item
itemvalue=
"Application.Othello"
/>
</list>
</recent_temporary>
</component>
<component
name=
"SvnConfiguration"
>
<configuration
/>
</component>
...
...
@@ -36,10 +59,56 @@
<option
name=
"presentableId"
value=
"Default"
/>
<updated>
1585636394558
</updated>
<workItem
from=
"1585636407800"
duration=
"72000"
/>
<workItem
from=
"1585656097487"
duration=
"2378000"
/>
<workItem
from=
"1585659438353"
duration=
"9321000"
/>
<workItem
from=
"1585687211713"
duration=
"16102000"
/>
<workItem
from=
"1585733466673"
duration=
"521000"
/>
</task>
<servers
/>
</component>
<component
name=
"TypeScriptGeneratedFilesManager"
>
<option
name=
"version"
value=
"1"
/>
</component>
<component
name=
"WindowStateProjectService"
>
<state
x=
"574"
y=
"97"
key=
"#com.intellij.ide.util.MemberChooser"
timestamp=
"1585694421216"
>
<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=
"1585694421216"
/>
<state
width=
"1493"
height=
"201"
key=
"GridCell.Tab.0.bottom"
timestamp=
"1585703421720"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1493"
height=
"201"
key=
"GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824"
timestamp=
"1585703421720"
/>
<state
width=
"1493"
height=
"201"
key=
"GridCell.Tab.0.center"
timestamp=
"1585703421720"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1493"
height=
"201"
key=
"GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824"
timestamp=
"1585703421720"
/>
<state
width=
"1493"
height=
"201"
key=
"GridCell.Tab.0.left"
timestamp=
"1585703421720"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1493"
height=
"201"
key=
"GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824"
timestamp=
"1585703421720"
/>
<state
width=
"1493"
height=
"201"
key=
"GridCell.Tab.0.right"
timestamp=
"1585703421720"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1493"
height=
"201"
key=
"GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824"
timestamp=
"1585703421720"
/>
<state
width=
"1493"
height=
"182"
key=
"GridCell.Tab.1.bottom"
timestamp=
"1585671521268"
>
<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"
>
<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"
>
<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"
>
<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=
"1585733471645"
>
<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"
/>
</component>
</project>
\ No newline at end of file
out/production/MyOthello/Block.class
0 → 100644
View file @
e19b199d
File added
out/production/MyOthello/Othello.class
0 → 100644
View file @
e19b199d
File added
out/production/MyOthello/User.class
0 → 100644
View file @
e19b199d
File added
src/Block.java
View file @
e19b199d
...
...
@@ -17,12 +17,12 @@ public class Block {
this
.
color
=
color
;
}
public
Character
changeColor
(){
public
void
changeColor
(){
if
(
color
.
equals
(
'b'
)){
return
'w'
;
setColor
(
'w'
)
;
}
else
return
'c'
;
setColor
(
'b'
)
;
}
public
int
getRow
()
{
...
...
src/User.java
0 → 100644
View file @
e19b199d
import
java.util.ArrayList
;
public
class
User
{
private
ArrayList
<
Block
>
userBlocks
;
private
ArrayList
<
Block
>
availableBlocksToPick
;
private
char
color
;
public
User
(){
userBlocks
=
new
ArrayList
<
Block
>();
availableBlocksToPick
=
new
ArrayList
<
Block
>();
}
public
void
addBlock
(
Block
block
){
userBlocks
.
add
(
block
);
}
public
boolean
isAvailableBlockToPick
(
Block
block
,
ArrayList
<
Block
>
blocks
)
{
int
i
,
j
;
int
flag1
=
0
;
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'
))
{
return
false
;
}
//check down
for
(
i
=
block
.
getRow
();
i
>
8
;
i
++)
{
// find the next block with chosen block color
for
(
Block
block1
:
blocks
)
{
if
(
block1
.
getRow
()
==
block
.
getRow
()
+
1
&&
block1
.
getColor
().
equals
(
color
))
{
flag1
=
1
;
break
;
}
if
(
flag2
==
1
)
{
// to not change " w b b b w b b w " to "w w w w w w w w"
break
;
}
if
(!
block1
.
getColor
().
equals
(
'n'
)
&&
block1
.
getRow
()
==
i
&&
block1
.
getColumn
()
==
block
.
getColumn
()
&&
block1
.
getColor
().
equals
(
color
))
{
flag2
=
1
;
flag3
=
1
;
}
}
if
(
flag1
==
1
)
break
;
}
//check up
flag1
=
0
;
flag2
=
0
;
for
(
i
=
block
.
getRow
()
-
1
;
i
>=
0
;
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
))
{
flag1
=
1
;
break
;
}
if
(
flag2
==
1
)
{
// to not change " w b b b w b b w " to "w w w w w w w w"
break
;
}
if
(!
block1
.
getColor
().
equals
(
'n'
)
&&
block1
.
getRow
()
==
i
&&
block1
.
getColumn
()
==
block
.
getColumn
()
&&
block1
.
getColor
().
equals
(
color
))
{
flag2
=
1
;
flag3
=
1
;
}
}
if
(
flag1
==
1
)
break
;
}
//check right
flag1
=
0
;
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
))
{
flag1
=
1
;
break
;
}
if
(
flag2
==
1
)
{
// to not change " w b b b w b b w " to "w w w w w w w w"
break
;
}
if
(!
block1
.
getColor
().
equals
(
'n'
)
&&
block1
.
getColumn
()
==
i
&&
block1
.
getRow
()
==
block
.
getRow
()
&&
block1
.
getColor
().
equals
(
color
))
{
flag2
=
1
;
flag3
=
1
;
}
}
if
(
flag1
==
1
)
break
;
}
//check left
flag1
=
0
;
flag2
=
0
;
for
(
i
=
block
.
getColumn
()
-
1
;
i
>=
0
;
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
))
{
flag1
=
1
;
break
;
}
if
(
flag2
==
1
)
{
// to not change " w b b b w b b w " to "w w w w w w w w"
break
;
}
if
(!
block1
.
getColor
().
equals
(
'n'
)
&&
block1
.
getColumn
()
==
i
&&
block1
.
getRow
()
==
block
.
getRow
()
&&
block1
.
getColor
().
equals
(
color
))
{
flag2
=
1
;
flag3
=
1
;
}
}
if
(
flag1
==
1
)
break
;
}
//check up and right
flag1
=
0
;
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
))
{
flag1
=
1
;
break
;
}
if
(
flag2
==
1
)
{
// to not change " w b b b w b b w " to "w w w w w w w w"
break
;
}
if
(!
block1
.
getColor
().
equals
(
'n'
)
&&
block1
.
getColumn
()
==
i
&&
block1
.
getRow
()
==
j
&&
block1
.
getColor
().
equals
(
color
))
{
flag2
=
1
;
flag3
=
1
;
}
}
if
(
flag1
==
1
)
break
;
}
//check down and left
flag1
=
0
;
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
))
{
flag1
=
1
;
break
;
}
if
(
flag2
==
1
)
{
// to not change " w b b b w b b w " to "w w w w w w w w"
break
;
}
if
(!
block1
.
getColor
().
equals
(
'n'
)
&&
block1
.
getColumn
()
==
i
&&
block1
.
getRow
()
==
j
&&
block1
.
getColor
().
equals
(
color
))
{
flag2
=
1
;
flag3
=
1
;
}
}
if
(
flag1
==
1
)
break
;
}
//check down and right
flag1
=
0
;
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
))
{
flag1
=
1
;
break
;
}
if
(
flag2
==
1
)
{
// to not change " w b b b w b b w " to "w w w w w w w w"
break
;
}
if
(!
block1
.
getColor
().
equals
(
'n'
)
&&
block1
.
getColumn
()
==
i
&&
block1
.
getRow
()
==
j
&&
block1
.
getColor
().
equals
(
color
))
{
flag2
=
1
;
flag3
=
1
;
}
}
if
(
flag1
==
1
)
break
;
}
//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
(
Block
block1
:
blocks
)
{
if
(
block1
.
getColumn
()
==
block
.
getColumn
()
-
1
&&
block1
.
getRow
()
==
block
.
getRow
()
-
1
&&
block1
.
getColor
().
equals
(
color
))
{
flag1
=
1
;
break
;
}
if
(
flag2
==
1
)
{
// to not change " w b b b w b b w " to "w w w w w w w w"
break
;
}
if
(!
block1
.
getColor
().
equals
(
'n'
)
&&
block1
.
getColumn
()
==
i
&&
block1
.
getRow
()
==
j
&&
block1
.
getColor
().
equals
(
color
))
{
flag2
=
1
;
flag3
=
1
;
}
}
if
(
flag1
==
1
)
break
;
}
if
(
flag3
==
0
)
{
return
false
;
}
return
true
;
}
/* public void updateAvailableBlockToPick(ArrayList<Block> blocks){
for (Block block : blocks){
if( isAvailableBlockToPick(block , blocks) == true){
availableBlocksToPick.add(block);
}
}
}*/
public
void
addAvailableBlockToPick
(
Block
block
){
availableBlocksToPick
.
add
(
block
);
}
public
void
removeAvailableBlockToPick
(
Block
block
){
availableBlocksToPick
.
remove
(
block
);
}
public
char
getColor
()
{
return
color
;
}
public
void
setColor
(
char
color
)
{
this
.
color
=
color
;
}
}
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