Urgent please from Ethiopia!
-
Hi friends, I am from Ethiopia. Could you please send/show me the C++ source code for 8-queens problem using hill climbing search method ? It is too urgent please? Thank you.
Hi friend, welcome in the forum. Plese read carefully "how to get an answer to your question" [^] before actually posting. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Hi friends, I am from Ethiopia. Could you please send/show me the C++ source code for 8-queens problem using hill climbing search method ? It is too urgent please? Thank you.
mekonnenn wrote:
It is too urgent please?
The lack of planning on your part does not constitute an emergency on our part.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
Hi friends, I am from Ethiopia. Could you please send/show me the C++ source code for 8-queens problem using hill climbing search method ? It is too urgent please? Thank you.
But we dont have eight queens. :-D
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
But we dont have eight queens. :-D
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
Yeah, we only have two and after Queen Astrid's accident[^] they are not allowed near or on any hill or mountain. :)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
-
Hi friends, I am from Ethiopia. Could you please send/show me the C++ source code for 8-queens problem using hill climbing search method ? It is too urgent please? Thank you.
The following coding come from china. It isn't writed by mine.
#include<stdio.h>
#define NUM 8 //定义数组的大小
int a[NUM+1];
int main()
{
int i,k,flag,not_finish=1,count=0;
i=1;
a[1]=1;
printf("The possible configuration of 8 queens are:\n");
while(not_finish)
{
while(not_finish&&i<=NUM)
{
for(flag=1,k=1;flag&&k<i;k++)
if(a[k]==a[i])flag=0;
for(k=1;flag&&k<i;k++)
if((a[i]==a[k]-(k-i))||(a[i]==a[k]+(k-i))) flag=0;
if(!flag)
{
if(a[i]==a[i-1])
{
i--;
if(i>1&&a[i]==NUM)
a[i]=1;
else if(i==1&&a[i]==NUM)
not_finish=0;
else a[i]++;
}
else if(a[i]==NUM) a[i]=1;
else a[i]++;
}
else if(++i<=NUM)
if(a[i-1]==NUM) a[i]=1;
else a[i]=a[i-1]+1;
}
if(not_finish)
{
++count;
printf((count-1)%3?" [%2d]: ":" \n[%2d]: ",count);
for(k=1;k<=NUM;k++)
printf(" %d",a[k]);
if(a[NUM-1]<NUM) a[NUM-1]++;
else a[NUM-1]=1;
i=NUM-1;
}
}
}
studing is processing in this life.