Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
8 Queens Problem

Subject: 8 Queens Problem

From: Shaun

Date: 4 Apr, 2010 19:59:05

Message: 1 of 3

My first question:
I need to create a function that "kills" like a queen. The board is an 8x8 of ones. The directions in which the queen can kills should all turn to zeroes. A number 3 should be used to depict where the queen is placed. The inputs should be row and column. And the output should be the changed board. I can't seem to figure out how to do this.

My second question:
I am then supposed to create a program which uses the queen function that prints out all the ways 8 queens can be placed on the board such that none of the queens is in the kill zone of another queen. The program should also display how many solutions it found. (There are 96 solutions, total.) The program should not take any user input. It just needs to be a regular script file.

If anybody could help out with this I would greatly appreciate it. Thanks!

Shaun

Subject: 8 Queens Problem

From: Roger Stafford

Date: 4 Apr, 2010 21:25:21

Message: 2 of 3

"Shaun " <shaunvon@iastate.edu> wrote in message <hpar29$q7p$1@fred.mathworks.com>...
> My first question:
> I need to create a function that "kills" like a queen. The board is an 8x8 of ones. The directions in which the queen can kills should all turn to zeroes. A number 3 should be used to depict where the queen is placed. The inputs should be row and column. And the output should be the changed board. I can't seem to figure out how to do this.
>
> My second question:
> I am then supposed to create a program which uses the queen function that prints out all the ways 8 queens can be placed on the board such that none of the queens is in the kill zone of another queen. The program should also display how many solutions it found. (There are 96 solutions, total.) The program should not take any user input. It just needs to be a regular script file.
>
> If anybody could help out with this I would greatly appreciate it. Thanks!
>
> Shaun
----------
  Yes, I remember doing that eight queens problem a number of years ago. The number of solutions I found was different from the 96 you quote. I won't take away from the enjoyment of the problem by telling how to do it. In my opinion problems like that are best appreciated if you do them entirely without anyone else's assistance, and I would advise you to try doing just that. If you succeed at this problem, you might like to solve the n x n generalization of it - you work with an n by n chess board. The program I wrote took quite a long time with a fifteen by fifteen board.

Roger Stafford

Subject: 8 Queens Problem

From: John D'Errico

Date: 5 Apr, 2010 00:16:05

Message: 3 of 3

"Shaun " <shaunvon@iastate.edu> wrote in message <hpar29$q7p$1@fred.mathworks.com>...
> My first question:
> I need to create a function that "kills" like a queen. The board is an 8x8 of ones. The directions in which the queen can kills should all turn to zeroes. A number 3 should be used to depict where the queen is placed. The inputs should be row and column. And the output should be the changed board. I can't seem to figure out how to do this.
>
> My second question:
> I am then supposed to create a program which uses the queen function that prints out all the ways 8 queens can be placed on the board such that none of the queens is in the kill zone of another queen. The program should also display how many solutions it found. (There are 96 solutions, total.) The program should not take any user input. It just needs to be a regular script file.
>
> If anybody could help out with this I would greatly appreciate it. Thanks!

But rather than giving up and asking us to do it
for you, you will gain far more by trying again.

It is possible. So try again.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us