Compare commits
3 Commits
2a6cea1951
...
472ea630da
| Author | SHA1 | Date | |
|---|---|---|---|
| 472ea630da | |||
| 6df297fc82 | |||
| 773679057e |
BIN
livrables/Class Diagram.png
Normal file
BIN
livrables/Class Diagram.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 122 KiB |
BIN
livrables/Sequence Diagram.png
Normal file
BIN
livrables/Sequence Diagram.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
BIN
livrables/pigeons.vpp
Normal file
BIN
livrables/pigeons.vpp
Normal file
Binary file not shown.
Binary file not shown.
BIN
livrables/rapport_question1.pdf
Normal file
BIN
livrables/rapport_question1.pdf
Normal file
Binary file not shown.
@@ -71,11 +71,14 @@ public class Bird implements Runnable {
|
|||||||
public Food findNearestFood() {
|
public Food findNearestFood() {
|
||||||
Food nearestFood = null;
|
Food nearestFood = null;
|
||||||
int minDistance = Integer.MAX_VALUE;
|
int minDistance = Integer.MAX_VALUE;
|
||||||
for (Food f : park.getFoods()) {
|
int i = 0;
|
||||||
|
while(i < park.getFoods().size()){
|
||||||
|
Food f = park.getFoods().get(i);
|
||||||
if (this.position.distance(f.getPosition()) < minDistance && f.isFresh()) {
|
if (this.position.distance(f.getPosition()) < minDistance && f.isFresh()) {
|
||||||
nearestFood = f;
|
nearestFood = f;
|
||||||
minDistance = this.position.distance(f.getPosition());
|
minDistance = this.position.distance(f.getPosition());
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
return nearestFood;
|
return nearestFood;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -243,4 +243,8 @@ public class Park extends JPanel implements MouseListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isBusy(){
|
||||||
|
return (numWriter.get() > 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user