Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Police
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
9731077
Police
Commits
4fe7eb62
Commit
4fe7eb62
authored
Apr 21, 2019
by
9731077
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finished
parent
22d731ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
2 deletions
+45
-2
Main.java
Main.java
+45
-2
No files found.
Main.java
View file @
4fe7eb62
package
PACKAGE_NAME
;
import
java.util.*
;
import
java.lang.Thread
;
public
class
Main
{
}
public
static
void
main
(
String
[]
args
)
throws
InterruptedException
{
final
Scanner
scan
=
new
Scanner
(
System
.
in
);
int
m
;
int
n
;
int
policeNumbers
;
System
.
out
.
println
(
"Enter m and n"
);
m
=
scan
.
nextInt
();
n
=
scan
.
nextInt
();
System
.
out
.
println
(
"Enter number of polices"
);
policeNumbers
=
scan
.
nextInt
();
Field
field
=
new
Field
(
m
,
n
);
field
.
randomPolicePlace
(
policeNumbers
);
field
.
randomRobberPlce
();
field
.
showFieldShape
();
System
.
out
.
println
(
"\n\n\n"
);
ArrayList
<
Police
>
polices
=
field
.
getPolices
();
while
(
true
)
{
field
.
getRobber
().
moveRandomly
(
m
,
n
);
field
.
showFieldShape
();
for
(
Police
police
:
polices
)
{
if
(!
police
.
lookingForRobber
(
m
,
n
,
field
.
getRobber
().
getX
(),
field
.
getRobber
().
getY
()))
police
.
moveRandomly
(
m
,
n
);
police
.
moveIntellegently
(
field
.
getRobber
().
getX
(),
field
.
getRobber
().
getY
());
}
field
.
changeField
();
field
.
showFieldShape
();
System
.
out
.
println
(
"\n\n\n"
);
Thread
.
sleep
(
3000
);
System
.
out
.
flush
();
}
}
}
\ No newline at end of file
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