feat(Map.java): ajout fonction bindPath

This commit is contained in:
2025-10-29 13:06:24 +01:00
parent 685313dc25
commit 04b95601ab

View File

@@ -1,19 +1,47 @@
import java.awt.Point; import java.awt.Point;
import java.util.ArrayList;
public class Map { public class Map
{
private Circuit[][] map; private Circuit[][] map;
private Point[] pathMap; private ArrayList<Point> pathMap;
public Map(Circuit[][] map) { public Map(Circuit[][] map)
{
this.map = map; this.map = map;
this.buildPath();
} }
private boolean buildPath() { private Point[] bindPath()
return false; {
Point start = null;
Point end = null;
for (int i = 0; i < map.length; i++)
{
for (int j = 0; j < map.length; j++)
{
switch (map[i][j].getType())
{
case CircuitCell.START:
if (start == null) start = new Point(i, j);
else return null;
break;
case CircuitCell.FINISH:
if (end == null) end = new Point(i, j);
else return null;
break;
default:
break;
}
}
}
return new Point[] {start, end};
} }
public Circuit getElement(int x, int y) {
public Circuit getElement(int x, int y)
{
return map[y][x]; return map[y][x];
} }
} }