+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Member Solidus's Avatar
    Join Date
    Aug 2000
    Location
    Chicago, IL
    Posts
    196

    Help!! Need eight queens solution in C++

    does anyone have a good, simple code that solves all 92 solutions to the eight queens problem? any help is appreciated.

  2. #2
    Banned qball's Avatar
    Join Date
    Oct 1999
    Location
    Rockaway, NJ 07866
    Posts
    1,730
    92 solutions to 8 queens, hmmmmm, er, hmmmm.

    The 8-queens problem is a well-known constraint satisfaction problem (CSP) of classical AI.
    oops: http://rana.usc.edu:8376/~yuri/queens/

    Show me 1 solution, the 91 others will easily follow...

  3. #3
    Ultimate Member eagle1's Avatar
    Join Date
    Mar 2000
    Location
    Guayama,P.R. , Puerto Rico
    Posts
    1,592
    A friend of mine was trying to do the same thing but I think he was using PROLOG! Let me see what I can find!

  4. #4
    Senior Member Banti's Avatar
    Join Date
    Dec 1999
    Location
    No Longer at Sysopt
    Posts
    903
    This would work for more than one solution... not sure if it will give all 92 answers, prob just 64.

    If you have a c++ code sample that will run similar to the applet.

    1.Pick one row of the eight.
    2.Pick one square of the eight in that row.
    3.Select this square as being one with a queen.
    4.Randomize the other 7 rows.
    5.Set the selected queen as immovable.
    6.Solve.
    7.Pick another square in the same row.
    8. repeat until all squares have been selected.


    Banti

  5. #5
    Banned qball's Avatar
    Join Date
    Oct 1999
    Location
    Rockaway, NJ 07866
    Posts
    1,730
    Banti,

    I think the real question is how does one accomplish "6.Solve.".

    Check out the above link, the guy does it in a neat applet (Yuri, you go boy!).

    Another issue, and I just don't know, may be the existence of 'unsolvable' squares. If you place the first queen in 1,1 (assume 8,8 array), you may not be able to solve the problem. Again, I just don't know if any squares like that exist, as i have a solution with a queen in a corner.

    Also, to truly capture all 92 solutions (how do we really know there are 92?), one needs to address the possibility that if I place the first queen on certain squares that have multiple solutions. Again, if one places queen in 1,1, there may exists 4 solution with a queen in 1,1.

    Interesting problem, not exactly sure how I would solve (who's kidding who, I'd email Yuri).

  6. #6
    Banned qball's Avatar
    Join Date
    Oct 1999
    Location
    Rockaway, NJ 07866
    Posts
    1,730
    too late is always good, right?

    nothing impressive:

    http://www.geocities.com/qballemail/8queens/8queens.htm

    Post back with any questions/problems/wise-*** repsonses.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts







New Security Features Planned for Firefox 4
Another Laptop Theft Exposes 21K Patients' Data
Oracle Hits to Road to Pitch Data Center Plans
Microsoft Preps Array of Windows Patches
Microsoft Nears IE9 Beta With Final Preview
Simplified Analytics Improve CRM, BI Tools
Android Passes RIM as Top Mobile OS in 2Q
VMware Updates Hyperic System Management
File Monitoring Key to Enterprise Security
LinkedIn Snaps Up SaaS Player mSpoke