全文预览

昆明理工大学人工智能实验报告

上传者:菩提 |  格式:doc  |  页数:10 |  大小:0KB

文档介绍
node_number+1; if(node_number==10000) // 有些情况可能不存在解,这里当 op等于 10000 时退出,并返回 0{ cout<<"node_number="<<node_number <<endl; // 扩展的节点数 cout<<"op="<<op<<endl; //open 表中的节点数 return 0; }} swapn(OPEN[begin].map[zero],OPEN[begin]. map[pos]); // 前边把 OPEN[min] 的值进行了交换,现在再换回去,保持 OPEN[min] 的 map 数组} CLOSE[cp++]=OPEN[begin]; begin=begin+1; } return 0; } void OutputSolution() { cout<<"eed!\n"; } int main(void) { //int map[9]={ 2, 8, 3, 1, 4, 0, 7, 6, 5 }; //{1,3,4,2,8,6,5,7,0}; //{6,4,7,8,5,0,3,2,1}; //{1,2,3,4,5,6,7,8,0}; //{2,8,3,1,0,4,7,6,5}; //{1,3,4,0,6,2,8,7,5}; int map[9]; cout<<" 请输入初始数组: "<<endl; for(int i=0;i<3;i++) for(int j=0;j<3;j++) cin>>map[3*i+j]; if(Astar(map)) cout<<"eed!"<<endl; else cout<<"no solution!\n"; cout<<" 按n 键退出"<<endl; char c; cin>>c; if(cin&&c!='n') { return 0; } return 0; }

收藏

分享

举报
下载此文档