Skip to content

Package up maze generation impls (and Ariadne's zipper?) into a project (Chapter 3) #7

Open
@cemerick

Description

@cemerick
Member

@cgrand, maybe you'd like to take care of this?

Activity

reopened this on Apr 11, 2012
rogerallen

rogerallen commented on May 16, 2012

@rogerallen

Not sure if this is the appropriate place or not, but I was creating a project based on the Ariadne zipper.

I ran into one issue that you might want to consider. Sometimes, two points cannot be connected. In this case, the zipper hangs.

Is there a way for the zipper to detect this hang situation and return an empty path?

cgrand

cgrand commented on May 16, 2012

@cgrand
Contributor

The Ariadne zipper only works on connected acyclic graphs — and the generated mazes are such graphs.
I'm pretty confident it can be adapted to work on larger (if not all) classes of graphs.
What can you tell me about your graph?

rogerallen

rogerallen commented on May 17, 2012

@rogerallen

I'm not creating my own graph, I'm just trying to use the code from the book. I created a gist here:

https://gist.github.com/2715291

I edited the code as little as possible from the text here:
https://github.com/clojurebook/ClojureProgramming/blob/master/ch03-collections-repl-interactions.clj
to get it to run and reproduce the issue. I tried to comment right where i modified the code. I can't figure it out...but I'm new to Clojure, as I just got the book this week.

If you load a repl via "java -jar clojure-1.3.0.jar", paste in the gist text, then invoke (testit) multiple times, it hangs relatively often for me (1 of 4 times at least). When it hangs, the maze is drawn (via my added first call with empty path), the println for the location of theseus & minotaur is output, but no path is drawn. I assume that the calculation of the path is hanging.

cgrand

cgrand commented on May 18, 2012

@cgrand
Contributor

Good catch: if the minotaur is in a dead-end, its location never appears in the value returned by z/path. It does only affect the version with the filter not the first one which just prints the path.

cgrand

cgrand commented on May 19, 2012

@cgrand
Contributor

@rogerallen fixed here 9ffe8d4

added a commit that references this issue on May 22, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @cgrand@cemerick@rogerallen

        Issue actions

          Package up maze generation impls (and Ariadne's zipper?) into a project (Chapter 3) · Issue #7 · clojurebook/ClojureProgramming