Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Recursive Function

  1. May 4, 2004 #1
    I have an assignment to write a recursive function that will safely place n Queens on an n x n chessboard. This wasn't all that difficult to figure out.

    For extra credit I'm supposed to write another function(s) (recursive?) that figures out all the possible solutions. This is, so far, giving me fits.

    Any nudge in the right direction would be greatly appreciated.
     
    Last edited: May 4, 2004
  2. jcsd
  3. May 4, 2004 #2

    dduardo

    User Avatar
    Staff Emeritus

    Can you be a little more specific in what you mean by figure out all the possible solutions? Do you mean once you place all the queens on the board, find all the possible moves which lead to a checkmate? That might take a while, especially if you have a bunch of queens. It is on the exponential scale.
     
  4. May 4, 2004 #3
    Sorry for not being clear. By solutions, I mean all the possible ways I can place the Queens safely. ie. No Queen can attack another Queen on the board.
     
  5. May 4, 2004 #4

    dduardo

    User Avatar
    Staff Emeritus

  6. May 4, 2004 #5
    Thanks dduardo.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Recursive Function
  1. Digamma Function (Replies: 1)

  2. C++ fun with recursion (Replies: 17)

  3. Graphing a function (Replies: 3)

  4. Adobe reader function (Replies: 2)

Loading...