Fork me on GitHub
#adventofcode
<
2016-12-30
>
bhauman05:12:08

@cjmurphy so mine didn't work for you?

bhauman05:12:05

my map was kind of easy, so I guess I just got lucky

cjmurphy06:12:05

Thanks @bhauman: Yours was the clean one that worked well for the test data and would get into loops for the real data. With some anti-loop code I got G to the top left in 235 steps - but that's too high. And my anti-loop code is just hacky. I don't know why it would work for you and get into recursive loops for me. It is as if I cut and pasted the data and missed a line, or I need to grab a more recent version of your code. Will get back to it next week...

bhauman15:12:48

@cjmurphy my data was pretty easy. I'd love to give it a try on your data.

cjmurphy18:12:10

@bhauman: Until now I assumed we all had the same puzzle input. Here's mine: https://github.com/chrismurrph/advent-of-code/blob/master/advent/twenty_two.txt.

bhauman19:12:09

@cjmurphy so if you pprint (use view-grid with 27 instead of 30 for your data) our two sets of data in grid form you will see that there is one row that blocks the progress. Your row is much higher so my score function fails. The simple thing to do is to have the score function detect if the row is the "wall" row and change its behavior based on wether it's above it or below it.

cjmurphy20:12:49

Thanks @bhauman . I see what you mean about the wall. Mine is on the 3rd row and yours is on 18th row. (post transpose, given your view-grid function does apply map vector, so a row is where all the ys are the same i.e. its really a column).

bhauman20:12:20

Well it really is a row in relation to the problem statement

bhauman20:12:25

When all the ys are the same it's a row

angusiguess22:12:09

@cjmurphy Mine didn't read super well but another way to sidestep those conditions is to do two searches. I did one bfs from the beginning to the goal, and then a search for each open space to move it to the point on the first path.