n-queen problem


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: n-queen problem

  1. #1
    jack Guest

    n-queen problem


    haw to disvolve n-queen problem in c++ using stack

  2. #2
    jonnin Guest

    Re: n-queen problem


    write it iteratively. place a queen at random, and cross off the squares that
    are now illegal(bool flags). repeat until all are placed. If cannot place
    them all, start over with new random location that was not used in last attempt.
    This is not the best method, but a modern machine can do it by brute force
    in short order, and the best solutions are all over the net, ...




    "jack" <yangj36@yahoo.com> wrote:
    >
    >haw to disvolve n-queen problem in c++ using stack



  3. #3
    jonnin Guest

    Re: n-queen problem


    Sorry. Use a stack where? anywhere? Missed that on first reading.


    "jonnin" <jonnin@vol.com> wrote:
    >
    >write it iteratively. place a queen at random, and cross off the squares

    that
    >are now illegal(bool flags). repeat until all are placed. If cannot place
    >them all, start over with new random location that was not used in last

    attempt.
    > This is not the best method, but a modern machine can do it by brute force
    >in short order, and the best solutions are all over the net, ...
    >
    >
    >
    >
    >"jack" <yangj36@yahoo.com> wrote:
    >>
    >>haw to disvolve n-queen problem in c++ using stack

    >



  4. #4
    Alex Guest

    Re: n-queen problem

    You could use backtracking (yeah, I know it's not the best method). I've
    got the sources in Pascal. If you want, I can send them to you.
    jack <yangj36@yahoo.com> wrote in message news:3a6d1083$1@news.devx.com...
    >
    > haw to disvolve n-queen problem in c++ using stack




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center