corrections et temps allongé pour les requetes

This commit is contained in:
2024-05-23 20:30:40 +02:00
parent 42737899cd
commit 79178886b6
2 changed files with 8 additions and 3 deletions

View File

@@ -6,7 +6,7 @@ import personnages.*;
import types.Item;
public class Main {
public static void main(String[] args) throws InterruptedException {
public static void main(String[] args) {
Personnage.n = 2;
Map map = new Map(20, 20);
@@ -19,6 +19,6 @@ public class Main {
// map.addObjects(Item.FRAISE, 0, 0);
// map.addObjectsRandomize(new Item[] {Item.FRAISE}, 1);
new Terminal(map, personnages).run(new String(), new String());
new Terminal(map, personnages).run("channel129", "channel128");
}
}

View File

@@ -88,7 +88,12 @@ public class Channel extends Personnage {
Mouvement mouvement;
System.out.println("Attente de l'autre joueur.");
while ((mouvement = conversionMouvement(recupererMessage())) == null) reseau.reconnexion(this.channel);
while ((mouvement = conversionMouvement(recupererMessage())) == null) {
reseau.reconnexion(this.channel);
try { Thread.sleep(500);
} catch (InterruptedException e) { e.printStackTrace(); }
}
this.moveSnake(mouvement);
int[] coordinate=this.getHeadCoordinate();