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
43e33a78
Commit
43e33a78
authored
Apr 05, 2020
by
9731301
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Pentago Class
parent
f1c5c8de
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
146 additions
and
6 deletions
+146
-6
vcs.xml
.idea/vcs.xml
+1
-0
workspace.xml
.idea/workspace.xml
+38
-4
Block.class
out/production/MyPentago/Block.class
+0
-0
Cell.class
out/production/MyPentago/Cell.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
+106
-0
User.java
src/User.java
+0
-1
No files found.
.idea/vcs.xml
View file @
43e33a78
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
"$PROJECT_DIR$"
vcs=
"Git"
/>
<mapping
directory=
"$PROJECT_DIR$/src"
vcs=
"Git"
/>
</component>
</project>
\ No newline at end of file
.idea/workspace.xml
View file @
43e33a78
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<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/vcs.xml"
beforeDir=
"false"
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"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
...
...
@@ -15,7 +18,7 @@
</option>
</component>
<component
name=
"Git.Settings"
>
<option
name=
"RECENT_GIT_ROOT_PATH"
value=
"$PROJECT_DIR$
/src
"
/>
<option
name=
"RECENT_GIT_ROOT_PATH"
value=
"$PROJECT_DIR$"
/>
</component>
<component
name=
"ProjectId"
id=
"1a7vHcpsUDZyxFcq1HeYNw9THGw"
/>
<component
name=
"ProjectLevelVcsManager"
settingsEditedManually=
"true"
/>
...
...
@@ -29,6 +32,20 @@
<property
name=
"WebServerToolWindowFactoryState"
value=
"false"
/>
<property
name=
"aspect.path.notification.shown"
value=
"true"
/>
</component>
<component
name=
"RunManager"
>
<configuration
name=
"Pentago"
type=
"Application"
factoryName=
"Application"
temporary=
"true"
nameIsGenerated=
"true"
>
<option
name=
"MAIN_CLASS_NAME"
value=
"Pentago"
/>
<module
name=
"MyPentago"
/>
<method
v=
"2"
>
<option
name=
"Make"
enabled=
"true"
/>
</method>
</configuration>
<recent_temporary>
<list>
<item
itemvalue=
"Application.Pentago"
/>
</list>
</recent_temporary>
</component>
<component
name=
"SvnConfiguration"
>
<configuration
/>
</component>
...
...
@@ -41,6 +58,7 @@
<updated>
1586099359973
</updated>
<workItem
from=
"1586099364327"
duration=
"87000"
/>
<workItem
from=
"1586105455800"
duration=
"97000"
/>
<workItem
from=
"1586105975356"
duration=
"8819000"
/>
</task>
<servers
/>
</component>
...
...
@@ -48,10 +66,26 @@
<option
name=
"version"
value=
"1"
/>
</component>
<component
name=
"WindowStateProjectService"
>
<state
x=
"281"
y=
"271"
key=
"com.intellij.ide.util.TipDialog"
timestamp=
"1586105456464"
>
<state
width=
"1493"
height=
"21"
key=
"GridCell.Tab.0.bottom"
timestamp=
"1586117772912"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1493"
height=
"21"
key=
"GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824"
timestamp=
"1586117772912"
/>
<state
width=
"1493"
height=
"21"
key=
"GridCell.Tab.0.center"
timestamp=
"1586117772912"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1493"
height=
"21"
key=
"GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824"
timestamp=
"1586117772912"
/>
<state
width=
"1493"
height=
"21"
key=
"GridCell.Tab.0.left"
timestamp=
"1586117772912"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1493"
height=
"21"
key=
"GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824"
timestamp=
"1586117772912"
/>
<state
width=
"1493"
height=
"21"
key=
"GridCell.Tab.0.right"
timestamp=
"1586117772912"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1493"
height=
"21"
key=
"GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824"
timestamp=
"1586117772912"
/>
<state
x=
"281"
y=
"271"
key=
"com.intellij.ide.util.TipDialog"
timestamp=
"1586106017061"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
x=
"281"
y=
"271"
key=
"com.intellij.ide.util.TipDialog/0.0.1536.824@0.0.1536.824"
timestamp=
"158610
5456464
"
/>
<state
x=
"281"
y=
"271"
key=
"com.intellij.ide.util.TipDialog/0.0.1536.824@0.0.1536.824"
timestamp=
"158610
6017061
"
/>
<state
x=
"25"
y=
"67"
key=
"new project wizard"
timestamp=
"1586105483065"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
...
...
out/production/MyPentago/Block.class
0 → 100644
View file @
43e33a78
File added
out/production/MyPentago/Cell.class
0 → 100644
View file @
43e33a78
File added
out/production/MyPentago/Pentago.class
0 → 100644
View file @
43e33a78
File added
out/production/MyPentago/User.class
0 → 100644
View file @
43e33a78
File added
src/Block.java
View file @
43e33a78
...
...
@@ -19,8 +19,8 @@ public class Block {
}
public
void
createCells
(){
Cell
cell
=
new
Cell
();
for
(
int
i
=
0
;
i
<
9
;
i
++
){
Cell
cell
=
new
Cell
();
cell
.
setNumber
(
i
);;
cell
.
setColor
(
'O'
);
allCells
.
add
(
cell
);
...
...
src/Pentago.java
0 → 100644
View file @
43e33a78
import
java.util.ArrayList
;
import
java.util.Scanner
;
public
class
Pentago
{
public
static
void
main
(
String
[]
args
){
ArrayList
<
Block
>
blocks
=
new
ArrayList
<>();
Scanner
scanner
=
new
Scanner
(
System
.
in
);
User
user1
=
new
User
();
User
user2
=
new
User
();
User
chosenUser
=
new
User
();
chosenUser
=
user2
;
user1
.
setColor
(
'⚫'
);
user2
.
setColor
(
'm'
);
int
blockNumber
;
int
cellNumber
;
int
i
,
j
;
String
turn
;
for
(
i
=
0
;
i
<
4
;
i
++
){
Block
block
=
new
Block
();
block
.
createCells
();
block
.
setNumber
(
i
);
blocks
.
add
(
block
);
}
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
==
8
){
break
;
}
if
((
i
==
0
||
i
==
2
)
&&
j
==
2
){
i
++;
j
=
0
;
}
else
if
((
i
==
0
||
i
==
2
)
&&
j
==
5
){
i
++;
j
=
3
;
}
else
if
((
i
==
0
||
i
==
2
)
&&
j
==
8
){
i
++;
j
=
6
;
}
else
if
((
i
==
1
)&&
j
==
8
){
i
=
2
;
j
=
0
;
System
.
out
.
println
(
"\n------------------"
);
continue
;
}
else
if
(
(
j
==
2
||
j
==
5
)
&&
(
i
==
1
||
i
==
3
)){
i
--;
j
++;
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
;
for
(
i
=
0
;
i
<
4
;){
System
.
out
.
print
(
"| "
+
blocks
.
get
(
i
).
getAllCells
().
get
(
j
).
getColor
()+
" "
+
blocks
.
get
(
i
).
getAllCells
().
get
(
j
+
1
).
getColor
()
+
" "
+
blocks
.
get
(
i
).
getAllCells
().
get
(
j
+
2
).
getColor
()
+
" |"
);
if
(
i
==
3
&&
j
==
8
){
break
;
}
if
((
i
==
0
||
i
==
2
)
&&
j
==
2
){
i
++;
j
=
0
;
}
else
if
((
i
==
0
||
i
==
2
)
&&
j
==
5
){
i
++;
j
=
3
;
}
else
if
((
i
==
0
||
i
==
2
)
&&
j
==
8
){
i
++;
j
=
6
;
}
else
if
((
i
==
1
)&&
j
==
8
){
i
=
2
;
j
=
0
;
System
.
out
.
println
(
"\n------------------"
);
continue
;
}
else
if
(
(
j
==
2
||
j
==
5
)
&&
(
i
==
1
||
i
==
3
)){
i
--;
j
++;
System
.
out
.
println
();
}
}
}
}
}
src/User.java
View file @
43e33a78
...
...
@@ -3,7 +3,6 @@ import java.util.ArrayList;
public
class
User
{
private
ArrayList
<
Cell
>
takenCells
;
private
Character
color
;
private
int
number
;
public
User
(){
takenCells
=
new
ArrayList
<
Cell
>();
...
...
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