From 0504c5affb46ba0664d57fc9be064386ae54da36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20GUEZO?= Date: Thu, 30 Oct 2025 19:51:02 +0100 Subject: [PATCH 1/2] fix: correction map.length -> map[0].length --- src/Map.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Map.java b/src/Map.java index a407a37..527b2c2 100644 --- a/src/Map.java +++ b/src/Map.java @@ -53,9 +53,9 @@ public class Map * Crée une map à partir d'un tableau d'entiers. * * @@ -66,9 +66,9 @@ public class Map { return create((i) -> switch (i) { case 0 -> new Circuit(CircuitCell.EMPTY); - case 1 -> new Circuit(CircuitCell.ROAD); - case 2 -> new Circuit(CircuitCell.START); - case 3 -> new Circuit(CircuitCell.FINISH); + case -1 -> new Circuit(CircuitCell.ROAD); + case -2 -> new Circuit(CircuitCell.START); + case -3 -> new Circuit(CircuitCell.FINISH); default -> new Circuit(CircuitCell.YROAD, i); }, map); } @@ -148,7 +148,7 @@ public class Map for (int i = 0; i < map.length; i++) { - for (int j = 0; j < map.length; j++) + for (int j = 0; j < map[0].length; j++) { switch (map[i][j].getType()) { From 47bbe1e7496c995fa42273ed531ce1f2e85ee9ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20GUEZO?= Date: Sat, 1 Nov 2025 10:28:50 +0100 Subject: [PATCH 2/2] fix(Map.java): changement position [0] <-> [1] --- src/Map.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Map.java b/src/Map.java index 527b2c2..c0a1411 100644 --- a/src/Map.java +++ b/src/Map.java @@ -207,8 +207,8 @@ public class Map for (int[] pos : coord) { - int x = current.x + pos[0]; - int y = current.y + pos[1]; + int x = current.x + pos[1]; + int y = current.y + pos[0]; if ((x >= 0 && map[0].length > x) && (y >= 0 && map.length > y)) {