What about a labyrinth solver function in 16 lines of Python?
Search
-
Recent Posts
Recent Activity
- Today, heated discussions, and a clean trunk with all pending branches reviewed and merged. Tomorrow, deployment begins! #ensemble #sprint 2 days ago
- Progress on the #Ensemble sprint! Washington feels better than I expected, btw. Being with @kapiltv and Malthe Borch helps too. 2 days ago
- Why am I so #pedantic? Can't hear the flight attendant saying "Please contact the front door." without laughing. 5 days ago
- After a few days off with a nice view of the Atlantic Forest, heading to another exciting sprint. http://tweetphoto.com/34621961 6 days ago
- RT @franciscosouza: mocker > world. Thanks @gniemeyer < Glad you're finding it helpful 6 days ago
Categories
Archive
- July 2010
- June 2010
- May 2010
- March 2010
- December 2009
- November 2009
- October 2009
- August 2009
- July 2009
- June 2009
- May 2009
- August 2008
- June 2008
- May 2008
- March 2008
- February 2008
- December 2007
- November 2007
- October 2007
- August 2007
- June 2007
- May 2007
- March 2007
- November 2006
- August 2006
- July 2006
- February 2006
- October 2005
- September 2005
- July 2005
- June 2005
- May 2005
- April 2005
- March 2005
- December 2004
- June 2004
- March 2004
- February 2004
- December 2003
- October 2003
- June 2003
When I first read the text, I thought “What? A solution to Labyrinthitis?”
A cure to labyrinthitis in 16 lines of Python would be *really* nice. Hehehe
Even shorter, but also more cryptic
from operator import or_ if reduce(or_, [solve(maze, posx+i, posy+j, sizex, sizey) for i,j in zip((1,-1,0,0), (0,0,1,-1))]):instead of:
if (solve(maze, posx+1, posy, sizex, sizey) or solve(maze, posx-1, posy, sizex, sizey) or solve(maze, posx, posy+1, sizex, sizey) or solve(maze, posx, posy-1, sizex, sizey)):How could this program print an output of the maze for every position the program moves?