"How can I put 8 queens on a chess board ?"

Hi ! I'm a brazilian programmer and my teacher gave me an challenge :

I've to put 8 queens on a chess board (they can't 'eat' themselves)

using only array controls.

The program must test all situations and return the solution.

Please, I need this answer until 12/19/98 !

Thamk you !!


Comments

  • : Hi ! I'm a brazilian programmer and my teacher gave me an challenge :

    : I've to put 8 queens on a chess board (they can't 'eat' themselves)

    : using only array controls.

    : The program must test all situations and return the solution.

    : Please, I need this answer until 12/19/98 !

    : Thamk you !!


    Have you played 7th guest? It has the same puzzle...

    Anyways, this program sounds rather simple.


    Here's a way to do it :


    1. Make an 8x8 array.

    2. Place the first queen in [1,1].

    3. Place the second queen in the next column.

    4. Check if either queen is going to get "eatin"

    5. If not then place the 3rd queen and so on.


    I'm sure you could get come up with some real code that follows the logic above.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories