/usr/lib64/python2.6/Demo/scripts
Edit: /usr/lib64/python2.6/Demo/scripts/queens.pyc (3046B)
Ñò
« gc @ sD d Z d Z d d d „ ƒ YZ d „ Z e d j o e ƒ n d S( 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.
i t Queensc B sS e Z e d „ Z d „ Z d d „ Z d „ Z d „ Z d „ Z d Z d „ Z
RS( c C s | | _ | i ƒ d S( N( t nt reset( t selfR ( ( s+ /usr/lib64/python2.6/Demo/scripts/queens.pyt __init__ s c C sf | i } d g | | _ d g | | _ d g d | d | _ d g d | d | _ d | _ d S( Ni i i ( R t Nonet yt rowt upt downt nfound( R R ( ( s+ /usr/lib64/python2.6/Demo/scripts/queens.pyR s i c C sˆ x t | i ƒ D]p } | i | | ƒ oW | i | | ƒ | d | i j o | i ƒ n | i | d ƒ | i | | ƒ q q Wd S( Ni ( t rangeR t safet placet displayt solvet remove( R t xR ( ( s+ /usr/lib64/python2.6/Demo/scripts/queens.pyR s c C s2 | i | o# | i | | o | i | | S( N( R R R ( R R R ( ( s+ /usr/lib64/python2.6/Demo/scripts/queens.pyR &