summary refs log tree commit diff stats
path: root/doc
Commit message (Expand)AuthorAgeFilesLines
* ranger.__init__, ranger.1: updated rangers descriptionhut2011-10-082-6/+6
* Updated man pagehut2011-10-082-24/+12
* ranger.1: added doc for --dont-copy-confighut2011-10-082-9/+7
* Write "ranger" with a lowercase "r"hut2011-10-082-4/+4
* updated manpage and config_examples/rc.confhut2011-10-082-1/+7
* general updateshut2011-10-083-31/+25
* manpage: updatehut2011-10-052-32/+34
* removed doc/TODO; use "make todo"hut2011-10-051-118/+0
* defaults/commands: added cunmap, punmap, tunmaphut2011-10-052-4
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class DFS {
    static int[][] directions = new int[][]{
        {+0, +1}, // Right.
        {+1, +0}, // Down.
        {+0, -1}, // Left.
        {-1, +0}, // Up.
    };

    static void traverse(int x, int y, char[][] maze, boolean[][] visited) {
        // Move in random direction.
        List<Integer> l = Arrays.asList(new Integer[]{0, 1, 2, 3});
        Collections.shuffle(l);

        for (int i: l) {
            int curx = x + directions[i][0];
            int a6c53cfe81d210c529c6e4c'>new version: 1.3.1, merge with cp+preview branch
hut2010-10-121-1/+1
|/
* Incremented version number to 1.3 (testing)hut2010-09-131-1/+1
* Beware of low-flying butterflies v1.2.0hut2010-09-131-1/+1
* chmodhut2010-09-111-0/+0
* Tuned versioning scheme to be more intuitive, back to 1.1.2hut2010-08-281-1/+1
* Changed version number to 1.2 (testing) to adhere with versioning schemehut2010-08-281-1/+1
* Changed default config dir to $XDG_CONFIG_HOME/rangerhut2010-08-282-6/+7
* Why did the astrophysicist order three hamburgers? v1.1.2hut2010-07-121-1/+1
* removed pydoc since it can be generated with "make doc" easilyhut2010-06-2146-6669/+0
* version = version + 1 v1.1.1hut2010-06-184-6/+7
* new stable version v1.1.0hut2010-06-092-3/+3
* updated manpagehut2010-06-091-5/+4
* renamed "--fail-if-run" to the more accurate "--fail-unless-cd"hut2010-06-091-3/+3
* updated pydochut2010-06-0918-57/+113
* Changed hashbang line to "#!/usr/bin/env python"hut2010-06-092-2/+2
span>(); // Found a solution, exiting. if (maze[curx][cury] == '$') System.exit(0); if (visited[curx][cury]) { continue; } else if (maze[curx][cury] == '.') { visited[curx][cury] = true; traverse(curx, cury, maze, visited); visited[curx][cury] = false; } } } public static void main(String[] args) { char[][] maze = { {'.', '#', '.', '#', '.', '.', '#', '.'}, {'.', '.', '.', '.', '.', '.', '.', '.'}, {'.', '#', '.', '.', '#', '.', '.', '$'}, {'.', '.', '.', '#', '.', '#', '.', '.'}, {'.', '.', '.', '.', '.', '.', '.', '#'}, {'.', '#', '#', '.', '.', '.', '#', '.'}, {'.', '.', '.', '.', '.', '.', '.', '.'}, }; boolean[][] visited = new boolean[maze.length][maze[0].length]; for (int i = 0; i < maze.length; i++) for (int j = 0; j < maze[i].length; j++) visited[i][j] = false; System.out.println(String.format("rows:%d cols:%d", maze.length, maze[0].length)); // Print the maze. for(int j = 0; j < maze.length; j++) for(int k = 0; k < maze[j].length; k++) System.out.print(maze[j][k]); System.out.println(); // Start at 0,0. visited[0][0] = true; traverse(0, 0, maze, visited); } }