Compare commits

..

4 Commits

Author SHA1 Message Date
valentinthedon
7651c78647 correctif taille titre 2022-11-21 15:53:23 -05:00
472ea630da depot des derniers livrables 2022-11-21 15:51:47 -05:00
6df297fc82 patch petit bug de modification concurente 2022-11-21 15:51:09 -05:00
773679057e regenerate jar 2022-11-21 15:50:05 -05:00
8 changed files with 9 additions and 2 deletions

View File

@@ -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. 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 : Depuis le dossier livrables, executer la commande suivantes :
```java -jar question1.jar``` ```java -jar question1.jar```

BIN
livrables/Class Diagram.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
livrables/pigeons.vpp Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -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;
} }

View File

@@ -243,4 +243,8 @@ public class Park extends JPanel implements MouseListener {
} }
} }
public boolean isBusy(){
return (numWriter.get() > 0);
}
} }