Commit eaf85402 authored by hosein's avatar hosein

main uodated

parent f576bb2b
...@@ -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);
} }
......
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