about summary refs log tree commit diff stats
path: root/algorithms
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2021-11-03 22:02:19 +0530
committerAndinus <andinus@nand.sh>2021-11-03 22:02:19 +0530
commit6b73ff7511a37c08be63c77ec66fc7c6c2be06b1 (patch)
treefa8c29368afb3d60b4be00acbd649a91ce912333 /algorithms
parenteafd5d5cf87c3c5c6783957ebfc815b356fd88fa (diff)
downloadfornax-6b73ff7511a37c08be63c77ec66fc7c6c2be06b1.tar.gz
Set ffmpeg verbosity
Diffstat (limited to 'algorithms')
-rw-r--r--algorithms/java/DFS.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/algorithms/java/DFS.java b/algorithms/java/DFS.java
index ba3d8d8..6b46ca6 100644
--- a/algorithms/java/DFS.java
+++ b/algorithms/java/DFS.java
@@ -40,8 +40,8 @@ public class DFS {
             System.out.println();
 
             // Found a solution, exiting.
-            // if (maze[curx][cury] == '$')
-            //     System.exit(0);
+            if (maze[curx][cury] == '$')
+                System.exit(0);
 
             if (visited[curx][cury]) {
                 continue;
@@ -55,13 +55,13 @@ public class DFS {
 
     public static void main(String[] args) {
         char[][] maze = {
-            {'.', '#', '.'},
-            {'.', '.', '.'},
-            {'.', '#', '.'},
-            {'.', '.', '.'},
-            {'.', '.', '#'},
-            {'.', '#', '.'},
-            {'.', '.', '$'},
+            {'.', '#', '.', '#', '.'},
+            {'.', '.', '.', '.', '.'},
+            {'.', '#', '.', '.', '$'},
+            {'.', '.', '.', '#', '.'},
+            {'.', '.', '.', '.', '#'},
+            {'.', '#', '#', '.', '.'},
+            {'.', '.', '.', '.', '.'},
         };
 
         boolean[][] visited = new boolean[maze.length][maze[0].length];