Commit 070a564a authored by 9731077's avatar 9731077

set First place of robber added

parent df12700b
......@@ -61,4 +61,26 @@ public class Field {
}
}
}
public void setFirstPlaceOfRobber(){
int tmpX, tmpY, cnt = 0;
while (true){
Random randomGenerator = new Random();
tmpX = randomGenerator.nextInt(m);
tmpY = randomGenerator.nextInt(n);
for (Police police : polices) {
if (police.getX() == tmpX && police.getY() == tmpY) {
cnt++;
break;
}
}
if (cnt == 0){
Robber robber = new Robber();
fieldShape[tmpX][tmpY] = "-";
return;
}
}
}
}
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