Large algorithm issue -- 5x5 grid, need to fit 5 queens plus some squares

Michael Spencer mahs at telcopartners.com
Thu Mar 16 09:51:32 EST 2006


Fredrik Lundh wrote:
> totalgeekdom at gmail.com wrote:
> 
>> The problem I'm trying to solve is.
>> There is a 5x5 grid.
>> You need to fit 5 queens on the board such that when placed there are
>> three spots left that are not threatened by the queen.
> 
> when you're done with your homework (?), you can compare it with
> Guido's solution:
> 
>     http://svn.python.org/view/python/trunk/Demo/scripts/queens.py
> 
> </F>
> 
> 
> 
Or, Tim Peters' generator-based one:

http://svn.python.org/view/python/trunk/Lib/test/test_generators.py

Michael




More information about the Python-list mailing list