Hacker Newsnew | past | comments | ask | show | jobs | submit | 61u's commentslogin

Just wondering... How do you calculate the minimum number of steps fast enough?


To solve a particular position, I just use level-by-level breadth-first search until a level contains two values that are reverses of each other.

To explore the entire state space of possible initial positions, I use a number of tricks; I'll be writing that up pretty soon. I've explored through n=12 already, and expect to finish n=13 and n=14 pretty soon. I'm not sure if I'll be able to do n=15.

And by the way, I've found a position for n=14 that requires 206 moves to solve.


You could just run bfs from both starting and ending nodes until you find a node reachable from both the starting and ending nodes.


https://ideone.com/MGFwdo

I am running BFS from only the starting node because the graph is symmetrical.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: