?? myqueen.cpp
字號:
#include "state.h"
#include<list>
#define N 8
#include <iostream>
using namespace std;
list<state> closedlist,openlist;
bool isInopenlist(state *s)
{
if(find(openlist.begin(),openlist.end(),*s)==openlist.end())
return false;
else return true;
}
bool isInclosedlist(state *s)
{
if(find(closedlist.begin(),closedlist.end(),*s)==closedlist.end())
return false;
else return true;
}
void main()
{
state res,state[8];
int i,j,k,count=65535;
for(i=0; i<N; i++)
{
cout<<"i="<<i<<endl;
for(j=0; j<N; j++)
{
state[j].trans(i,j);
state[j].inc_h();
state[j].compute_g();
if(count > state[j].get_f())
{
count=state[j].get_f();
cout<<"此時f的值為:"<<count<<endl;
res.trans(i,j);
state[j].show();
}
}
if(res.get_f()==0) exit(0);
res.compute_g();
for(k=0; k<N; k++)
state[k]=res;
cout<<"\n";
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -