A colleague provided a maze-solving challenge that I reduced to a game that can be played at the following link:<p>https://ryan-duve.github.io/mazeball.html<p>The challenge is to find the shortest sequence of moves to get all the red balls to the green square, as well as an algorithm to generate that sequence. I made the game to guide my intuition and solved it in 188 moves just by eyeballing[1], but I am confident there are considerable gains to be made.<p><i>Warning</i>: Javascript is not my primary language, and I have no idea how to make a good webapp. As a result, this is hugely unoptimized and probably unplayable on mobile despite my best Stack Overflow efforts and timeboxing the whole thing to this afternoon. If Javascript is your cup of tea and you are interested in helping improve this, drop me a message on Github[2].<p>Take a look, have fun and let me know if you come up with a cool solution.<p>[1] [see comment for long link]<p>[2] https://github.com/ryan-duve/maze_ball
265 <a href="https://ryan-duve.github.io/mazeball.html?solution=DDDRRLDDLLLLLLLUUUUUULLLURRRUUURRRRRRRRRRRRDDDDDDDDDDDDDRRRRRRRRRRDDDRRRRRRRRRDLLLLLLLLLLDDDDDDDDDDDDDDRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRUUUUUUULLLUURRRRRRRDDDDDDDDDDDDDLLLLLLLLLLLRDDRRRRRRRRRRRRRRRRUUUUDRRRRRUUUUUUURRRRRRRRRRRRRRRRRRRDDLUULLLLLDDLLLDDDDDDRRRRLUUU" rel="nofollow">https://ryan-duve.github.io/mazeball.html?solution=DDDRRLDDL...</a><p>It's not clear that initially all the grey squares have balls.<p>Some feature request:<p>* Add a button to restart, specially after the game ended. Perhaps save the best score in case people keep playing.<p>* Add an undo button?
The long link to the provided solution is below. Putting it in the body of the post made the post body go really far off the edge of the screen.<p><a href="https://ryan-duve.github.io/mazeball.html?solution=RRDDLDDDDLLLLLLUUUUUURRRUUUUUUUUUUUUUUUUUUUUUUUUUUUURRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRDDDDDDDDDDDLLLLLLLLLLDDDDDDDDDDDDDRRRRRRRRRRDRUUUUUUUUUURRRRRRRRRRRRRRRRRRRRRRRRLLLLLDDRRRDDDDDDLLLUUU" rel="nofollow">https://ryan-duve.github.io/mazeball.html?solution=RRDDLDDDD...</a>