Skip to content
Snippets Groups Projects
Commit 3f7fc718 authored by NET-D3v3l0p3r's avatar NET-D3v3l0p3r
Browse files

2 Ansätze -> simples flood fill

parent 7990f5d0
No related branches found
No related tags found
No related merge requests found
...@@ -3,10 +3,14 @@ ...@@ -3,10 +3,14 @@
import window.MainWindowApproach1; import window.MainWindowApproach1;
import window.MainWindowApproach2; import window.MainWindowApproach2;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
public class Program { public class Program {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
MainWindowApproach2 window = new MainWindowApproach2("Pathfinder v1", 1080, 1080); MainWindowApproach2 window = new MainWindowApproach2("Pathfinder v1", 1080, 1080);
window.run(); window.run();
......
...@@ -50,6 +50,18 @@ public class Explorer { ...@@ -50,6 +50,18 @@ public class Explorer {
boolean down boolean down
= SharedRessources.getInstance().isWall(x, y + 1) ; = SharedRessources.getInstance().isWall(x, y + 1) ;
boolean leftUp =
SharedRessources.getInstance().isWall(x - 1, y- 1);
boolean rightUp =
SharedRessources.getInstance().isWall(x + 1, y- 1);
boolean leftDown =
SharedRessources.getInstance().isWall(x - 1, y + 1);
boolean rightDown =
SharedRessources.getInstance().isWall(x + 1, y + 1);
int stepLeft int stepLeft
= SharedRessources.getInstance().getStep(x - 1, y); = SharedRessources.getInstance().getStep(x - 1, y);
int stepRight int stepRight
...@@ -59,6 +71,9 @@ public class Explorer { ...@@ -59,6 +71,9 @@ public class Explorer {
int stepDown int stepDown
= SharedRessources.getInstance().getStep(x, y + 1); = SharedRessources.getInstance().getStep(x, y + 1);
if(!left && !right && !up && !down && !rightDown && !rightUp && !leftDown && !leftUp)
continue;
if (!left) { if (!left) {
if (steps < stepLeft) { if (steps < stepLeft) {
SharedRessources.getInstance() SharedRessources.getInstance()
...@@ -113,6 +128,8 @@ public class Explorer { ...@@ -113,6 +128,8 @@ public class Explorer {
} }
System.out.println("Done.");
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment