This program uses a int type number to represent the Eight Puzzle Problem. number 1,2,3,…,8 stand for the eight numbers,0 stand for blank space. row from top to bottom,column from left to right. default goal state:01234578 or 1234578
c++实现八数码游戏,有A*函数优化 #include #include #include #include #include using namespace std; int bn[3][3] = {2,8,3,1,6,4,7,0,5}; int en[3][3] = {1,2,3,0,8,4,7,6,5}; class node { public: int no[3][3]; int position[4][2];//可能方向1上2右3下4左 int ii,ij; int g;