ó Afc@sBdZdZddd„ƒYZd„Zedkr>eƒndS(s¹N queens problem. The (well-known) problem is due to Niklaus Wirth. This solution is inspired by Dijkstra (Structured Programming). It is a classic recursive backtracking approach. itQueenscBsSeZed„Zd„Zdd„Zd„Zd„Zd„ZdZ d„Z RS(cCs||_|jƒdS(N(tntreset(tselfR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyt__init__s cCsf|j}dg||_dg||_dgd|d|_dgd|d|_d|_dS(Niii(RtNonetytrowtuptdowntnfound(RR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyRs  icCs„x}t|jƒD]l}|j||ƒr|j||ƒ|d|jkrX|jƒn|j|dƒ|j||ƒqqWdS(Ni(trangeRtsafetplacetdisplaytsolvetremove(RtxR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyRs cCs0|j| o/|j|| o/|j|| S(N(RRR (RRR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyR &scCs@||j| s 8