Commit 4fe7eb62 authored by 9731077's avatar 9731077

finished

parent 22d731ec
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment