Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
police and thief
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
9731075
police and thief
Commits
eaf85402
Commit
eaf85402
authored
Apr 19, 2019
by
hosein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
main uodated
parent
f576bb2b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
14 deletions
+69
-14
Main.java
src/pack/Main.java
+69
-14
No files found.
src/pack/Main.java
View file @
eaf85402
...
@@ -3,7 +3,7 @@ package pack;
...
@@ -3,7 +3,7 @@ package pack;
import
java.util.Scanner
;
import
java.util.Scanner
;
public
class
Main
{
public
class
Main
{
public
static
void
main
(
String
args
[]
)
{
public
static
void
main
(
String
[]
args
)
{
Scanner
input
=
new
Scanner
(
System
.
in
);
Scanner
input
=
new
Scanner
(
System
.
in
);
System
.
out
.
print
(
"Enter n: "
);
System
.
out
.
print
(
"Enter n: "
);
...
@@ -25,22 +25,20 @@ public class Main {
...
@@ -25,22 +25,20 @@ public class Main {
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
int
[][]
thiefSituation
=
new
int
[
1
][
2
]
;
int
[][]
thiefSituation
;
int
c
=
0
;
playGround
.
show
(
1000
);
for
(
int
j
,
z
=
0
;
z
<
playGround
.
getNM
()[
0
][
0
];
z
++)
for
(
j
=
0
;
j
<
playGround
.
getNM
()[
0
][
1
];
j
++)
if
(
playGround
.
getGround
()[
z
][
j
]
==
1
)
c
++;
System
.
out
.
println
(
"c ============== "
+
c
);
playGround
.
show
(
120
);
System
.
out
.
print
(
"\n\n\n\n"
);
System
.
out
.
print
(
"\n\n\n\n"
);
do
{
do
{
thiefSituation
=
playGround
.
canPoliceSeeThief
();
thiefSituation
=
playGround
.
canPoliceSeeThief
();
if
(
thiefSituation
==
null
)
{
thief
.
randomMove
(
n
,
m
,
playGround
);
thiefSituation
=
playGround
.
canPoliceSeeThief
();
if
(
thiefSituation
==
null
)
{
if
(
thiefSituation
==
null
)
{
for
(
i
=
0
;
i
<
pn
;
i
++)
for
(
i
=
0
;
i
<
pn
;
i
++)
polices
[
i
].
randomMove
(
n
,
m
,
playGround
);
polices
[
i
].
randomMove
(
n
,
m
,
playGround
);
...
@@ -50,10 +48,67 @@ public class Main {
...
@@ -50,10 +48,67 @@ public class Main {
if
(
playGround
.
getCatchThief
())
break
;
if
(
playGround
.
getCatchThief
())
break
;
}
}
}
}
if
(
playGround
.
getCatchThief
())
{
System
.
out
.
println
(
"they catch him!"
);
break
;}
}
else
else
playGround
.
show
(
120
);
do
{
thief
.
targetedMove
(
playGround
);
for
(
i
=
0
;
i
<
pn
;
i
++)
{
polices
[
i
].
targetedMove
(
thiefSituation
,
playGround
);
if
(
playGround
.
getCatchThief
())
break
;
}
if
(
playGround
.
getCatchThief
())
{
playGround
.
show
(
1200
);
System
.
out
.
println
(
"they catch him!"
);
break
;
}
else
playGround
.
show
(
1200
);
System
.
out
.
print
(
"\n\n\n\n"
);
System
.
out
.
print
(
"\n\n\n\n"
);
}
while
(!
playGround
.
catchThief
());
}
while
(
true
);
if
(
playGround
.
getCatchThief
())
{
break
;
}
else
playGround
.
show
(
1200
);
System
.
out
.
print
(
"\n\n\n\n"
);
/* thiefSituation = playGround.canPoliceSeeThief();
if (thiefSituation == null) {
for (i = 0; i < pn; i++)
polices[i].randomMove(n, m, playGround);
if (playGround.canPoliceSeeThief() == null) {
thief.randomMove(n, m, playGround);
} else {
thief.targetedMove(playGround);
}
} else {
for (i = 0; i < pn; i++) {
polices[i].targetedMove(thiefSituation, playGround);
if (playGround.getCatchThief()) break;
}
if (playGround.canPoliceSeeThief() == null) {
thief.randomMove(n, m, playGround);
} else {
thief.targetedMove(playGround);
}
}
if (playGround.getCatchThief()) {
System.out.println("they catch him!");
break;
} else playGround.show(1200);
System.out.print("\n\n\n\n");
*/
}
while
(
true
);
}
}
...
...
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