From: Shaun on 4 Apr 2010 15:59 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
From: Roger Stafford on 4 Apr 2010 17:25 "Shaun " <shaunvon(a)iastate.edu> wrote in message <hpar29$q7p$1(a)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
From: John D'Errico on 4 Apr 2010 20:16 "Shaun " <shaunvon(a)iastate.edu> wrote in message <hpar29$q7p$1(a)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.
|
Pages: 1 Prev: Denoise a signal Next: Optimization Toolbox in Release12? |