8 queen problem with a twist

  • (2 Pages)
  • +
  • 1
  • 2

16 Replies - 685 Views - Last Post: 04 August 2014 - 05:28 AM Rate Topic: **--- 3 Votes

#16 Darraptor  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 63
  • Joined: 11-May 14

Re: 8 queen problem with a twist

Posted 03 August 2014 - 11:37 PM

View PostSkydiver, on 02 August 2014 - 06:25 AM, said:

If you are not being graded on algorithm design and efficiency, you could go for the brute force algorithm. In pseudo code:
for each row
    for each column
        if row,col is occupied
            continue
        place queen at row,col
        check if valid
        if invalid
            undo placing queen at row, col



If I wasn't assigning a certain amount of queens a position on the board I wouldnt have too much trouble but Im really lost right now could you help. Sorry if I sound annyoing but ive been doing this for hours and i really can't get it
Was This Post Helpful? 0
  • +
  • -

#17 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3570
  • View blog
  • Posts: 11,095
  • Joined: 05-May 12

Re: 8 queen problem with a twist

Posted 04 August 2014 - 05:28 AM

Show us your code for how you solve the problem when the board is completely blank. Notice, that the way that works is by attempting to place the queen and then seeing if it is valid, and if so it continues on, otherwise it undoes that placement.

How is the computer placing some of the queens any different from the human first placing some of the queens?
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2