COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### 8 Queens Problem

• Email
• Follow

```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
```
 0

See related articles to this posting

```"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
```
 0

```"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.
```
 0

2 Replies
896 Views

Similar Articles

12/6/2013 3:49:47 PM
page loaded in 62628 ms. (0)

Similar Artilces:

hi #8
hi this is johnbechem your giving informaton to the people is very helpfull to this world .I thought you will be increase the many topics... ---------------------------------------------------------------------------------------------------------------- bechem <A href="http://www.alcoholaddiction.org/missouri>Missouri Alcohol Addiction Treatment</a>

activeX #8
hello all, I've been creating a new gui, and I think i've used all the basic posibilities that enables matlab. Now i've discovered activeX but i've some problems. 1)i'm working with matlab 7.1 and i've read that activeX is available for matlab 6.0 and up. The problem is that, when i try to create some activeX control, matlab crashes and i don't know why... 2)what's the basic purpose of activeX? 3)can i customize my own activeX controls??? how?? thanks a lot.

KeypressFcn #8
Salam I have a problem with the edit of keypressfcn when I press enter the value given by the user is lost and if press again show the old value a month and I can not resolved help me please thank you function varargout = mygui2(varargin) gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @mygui2_OpeningFcn, ... 'gui_OutputFcn', @mygui2_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin & isstr(varargin{1}) gui_State.gui_Callback = str2func(varargin{1})

printf #8
source of taxation is found it never means, in practice, that the old source is abandoned. It merely means that the politicians have two ways of milking the taxpayer where they had one before. 8 H. L. Mencken "Ron Ford" <ron@example.invalid> wrote in message > [sprintf ] > I'd be curious to see a useful snippet. >> > sprintf() can be written portably. printf() cannot, though it can be written on top of putchar(), which has to be platform-specific. An example use would be in BasicDraw. Microsoft have provided a function for setting the window title which...) { longarg =3D va_arg(arg_ptr, long); radix_long_to_str(longarg, str, 8); } else { intarg =3D va_arg(arg_ptr, int); radix_int_to_str(intarg, str, 8); } fmax =3D 0; break; case 'X': case 'x': if (longflag) { longarg =3D va_arg(arg_ptr, long); radix_long_to_str(longarg, str, 16); } else { intarg =3D va_arg(arg_ptr, int

Constructor #8
Hi, I've a class that contains a private member object that in turn is a reference: class A { public: A( classB & ); private: classB &mB; }; A::A( classB &B ) : mB( B ) { } What happens in the constructor? Will the copy constructor of classB be invoked? Or will just the reference of B be assigned to mB without calling any constructors? Is it reasonable to add a copy constructor and an assignment operator for class A? Or will this be handled by the default constructors and operators? Regards, Chris Christian Christmann wrote: > Hi, > > I'

Redirect #8
Hello I want to redirect www.mysite.com/aaaa/p1/p2/p3 to www.mysite.com/bbbb/ p1/p2/p3, because Google has indexed sites with 'aaaa' and 'bbbb'. But they are the same sites. I can't do it in .htaccess file becasue I'm taking p3 parameter from mysql database. So I think that only way is to do it in PHP. I'm a complete novice at redirects. So maybe anyone could help me....how to do it? MM On Fri, 16 Feb 2007 19:36:18 +0100, <mariusz@polbank.info> wrote: > Hello > > I want to redirect www.mysite.com/aaaa/p1/p2/p3 to www.mysite.com/bbbb= / > p1

mcc #8
Hi, I have matlab version 7.2.0.232(R2006a) Is the command mcc in this version? I have wrotten help mcc but it couldn't find this function Thanks Kutaiba

indexing #8
i've got a simple question: why having a matrix, for ex: A=[ 1 2 3 4; 2 1 3 1; 3 4 2 4] i cannot change indexing in one step, by doing smth like: sub2ind(size(A), 1:size(A,1), 1:size(A,2)) matlab screams: ??? Error using ==> sub2ind The subscripts vectors must all be of the same size. how can i change indexing of the whole matrix in one step?

tape command for solaris 8
Is there a unix command 1. to label a tape? write "tape1", "tape2", etc to the tape. 2. to tell whether a tape is blank (no data)? 3. to tell a tape is write-protected? 4. to tell a tape drive is empty (no tape is inserted)? 5. What is the difference between tar and ufsdump? In article <451a2a55.0308121056.3c0d5a82@posting.google.com>, ma7777772@hotmail.com (TingChong) wrote: > Is there a unix command > 1. to label a tape? write "tape1", "tape2", etc to the tape. In general, there's no tape facility on Solaris that uses ANSII label