Compare commits
4 Commits
2a6cea1951
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7651c78647 | ||
| 472ea630da | |||
| 6df297fc82 | |||
| 773679057e |
@@ -16,7 +16,7 @@ L'espace de travail dispose de plusieurs dossiers :
|
||||
|
||||
Pour lancer notre application, executer simplement notre fichier ```question1.jar ``` présent dans le dossier ```livrables```, en double cliquant sur le fichier.
|
||||
|
||||
# En ligne de commande
|
||||
### En ligne de commande
|
||||
|
||||
Depuis le dossier livrables, executer la commande suivantes :
|
||||
```java -jar question1.jar```
|
||||
|
||||
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() {
|
||||
Food nearestFood = null;
|
||||
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()) {
|
||||
nearestFood = f;
|
||||
minDistance = this.position.distance(f.getPosition());
|
||||
}
|
||||
i++;
|
||||
}
|
||||
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