clojure-madison

Cora (she/her) 2019-07-01T16:53:48.001700Z

soooo I did a thing, finally got it working last night https://github.com/nate/labyrinth

Cora (she/her) 2019-07-01T16:54:31.002Z

http://monosnap.sutton.me/20190701113612-1._bash.png

Cora (she/her) 2019-07-01T16:54:50.002400Z

my first serious-ish clojure project

Cora (she/her) 2019-07-01T17:32:43.002800Z

it needs tests, badly

2019-07-01T17:33:51.004100Z

Neat, you could try a generative test checking that you can get from one point in the maze to any other point

Cora (she/her) 2019-07-01T17:34:55.004800Z

oh a solver is definitely on my list

Cora (she/her) 2019-07-01T17:35:17.005200Z

I want to name it minotaur (not theseus because no one remembers him)

2019-07-01T17:35:49.005700Z

I'll give look over the code after work for you

Cora (she/her) 2019-07-01T17:35:58.005900Z

oh that would be awesome, thanks!

Cora (she/her) 2019-07-01T17:36:15.006200Z

please be merciless, I really want to improve

Cora (she/her) 2019-07-01T17:36:33.006600Z

I probably should add docs or at least reasoning for why things are put together how they are

Cora (she/her) 2019-07-01T17:36:39.006800Z

there's always more to do, I suppose

2019-07-01T18:12:57.007500Z

A simple test would be checking that all squares have at least one "open" side

Cora (she/her) 2019-07-01T18:15:10.008Z

hmmm

Cora (she/her) 2019-07-01T18:15:34.008600Z

if one open side faced the open side of another cell, that would pass that test

Cora (she/her) 2019-07-01T18:17:38.009300Z

solving the maze seems incredibly amenable to parallelism

Cora (she/her) 2019-07-01T18:19:54.011400Z

start with a threadpool working off a queue, in the main thread add the different directions off the entrance to the queue. each thread walks the direction until it reaches another decision point where it enqueues the two+ directions that are possible, repeat

Cora (she/her) 2019-07-01T18:20:07.011700Z

and then be listening on a channel for when the exit is found

Cora (she/her) 2019-07-01T18:20:32.012200Z

sort of flooding the maze by using threads, letting each thread handle flooding of one direction

Cora (she/her) 2019-07-01T18:22:15.013Z

if it's not a perfect maze then you could let the threads continue to flood the maze and then compare the paths to get the shortest one

Cora (she/her) 2019-07-01T18:29:09.013800Z

terminating the threads might be tricky

Cora (she/her) 2019-07-01T18:29:42.014400Z

but I guess if you have a quit channel and a queue channel and the thread pool listens on each with alts, preferring the quit channel, then we can just close the quit channel to force all the threads to exit

Cora (she/her) 2019-07-01T18:29:48.014600Z

or go blocks or what have you

2019-07-01T18:42:04.015800Z

From playing around with go blocks and multi threaded tasks in the past my advice is to get a serial process working first. Concurrency even in Clojure gets tricky and hard to debug very fast 🙂

Cora (she/her) 2019-07-01T18:44:20.016100Z

for sure

Cora (she/her) 2019-07-01T18:44:50.016600Z

I rewrote this library at one point, made it work 98% better: https://github.com/igrigorik/agent

Cora (she/her) 2019-07-01T18:45:12.017300Z

but eventually I just ripped it out of my projects and used forking so everything could be done serially yet in parallel

Cora (she/her) 2019-07-01T18:45:29.017500Z

also because ruby

Cora (she/her) 2019-07-01T19:04:34.017800Z

always because ruby