Your IP : 3.144.123.61


Current Path : /lib64/python2.7/Demo/scripts/
Upload File :
Current File : //lib64/python2.7/Demo/scripts/queens.pyc

�
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|<d|j|<d|j||<d|j||<dS(Ni(RRRR	(RRR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyR
)s

cCs@d|j|<d|j|<d|j||<d|j||<dS(Ni(RRRRR	(RRR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyR/s

cCs�|jd|_|jrdSdd|jdGHxbt|jddd�D]G}dGx5t|j�D]$}|j||kr�dGqedGqeWdGHqKWdd|jdGHdS(	Nis+-s--t+i����t|tQt.(R
tsilentRRR(RRR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyR7s	 	(t__name__t
__module__tNRRRRR
RRR(((s+/usr/lib64/python2.7/Demo/scripts/queens.pyRs	
			cCs�ddl}d}t}|jdd!dgkrDd}|jd=n|jdrgt|jd�}nt|�}||_|j�dG|jGdGHdS(Ni����iiis-ntFounds
solutions.(tsysRtargvtintRRRR
(RRRtq((s+/usr/lib64/python2.7/Demo/scripts/queens.pytmainFs

	
t__main__N((t__doc__RRRR(((s+/usr/lib64/python2.7/Demo/scripts/queens.pyt<module>
s
8	

?>