class state
{
protected:
int iStateNumber;//状态编号
int iopNumber;//当前最大操作编号
public:
int iCenobite;//修道士数
int iWildManA;//会划船的野人数
int iWildManB;//不会划船的野人数
int iBank;//0表示此岸,1表示彼岸
state * pFather,* pChild;//指向父、子结点的指针
state(int,int,int,int);
~state();
int setNumber(int);
int getNumber();
void operate();
int isError();
int getOpNumber();
void setOpNumber(int);
int addOpNumber();
void getState(int *);
int isTarget();
int isStart();
七.【运行结果】
Find one method! the number is 1
(3,2,1,0)->(2,1,1,1)->(3,1,1,0)->(3,0,0,1)->(3,1,0,0)->(1,1,0,1)->(2,1,1,0)->(0,1,1,1)->(0,2,1,0)->(0,0,1,1)->(1,0,1,0)->(0,0,0,1)
Find one method! the number is 2
(3,2,1,0)->(2,1,1,1)->(3,1,1,0)->(3,0,0,1)->(3,1,0,0)->(1,1,0,1)->(2,1,1,0)->(0,1,1,1)->(0,2,1,0)->(0,0,1,1)->(0,1,1,0)->(0,0,0,1)
Find one method! the number is 3
(3,2,1,0)->(2,1,1,1)->(3,1,1,0)->(3,0,0,1)->(3,1,0,0)->(1,1,0,1)->(2,1,1,0)->(0,1,1,1)->(0,2,1,0)->(0,1,0,1)->(1,1,0,0)->(0,0,0,1)
Find one method! the number is 4
(3,2,1,0)->(2,1,1,1)->(3,1,1,0)->(3,0,0,1)->(3,1,0,0)->(1,1,0,1)->(2,1,1,0)->(0,1,1,1)->(0,2,1,0)->(0,1,0,1)->(0,2,0,0)->(0,0,0,1)
Find one method! the number is 5
(3,2,1,0)->(3,0,1,1)->(3,1,1,0)->(3,0,0,1)->(3,1,0,0)->(1,1,0,1)->(2,1,1,0)->(0,1,1,1)->(0,2,1,0)->(0,0,1,1)->(1,0,1,0)->(0,0,0,1)
Find one method! the number is 6
(3,2,1,0)->(3,0,1,1)->(3,1,1,0)->(3,0,0,1)->(3,1,0,0)->(1,1,0,1)->(2,1,1,0)->(0,1,1,1)->(0,2,1,0)->(0,0,1,1)->(0,1,1,0)->(0,0,0,1)
Find one method! the number is 7
(3,2,1,0)->(3,0,1,1)->(3,1,1,0)->(3,0,0,1)->(3,1,0,0)->(1,1,0,1)->(2,1,1,0)->(0,1,1,1)->(0,2,1,0)->(0,1,0,1)->(1,1,0,0)->(0,0,0,1)
Find one method! the number is 8
(3,2,1,0)->(3,0,1,1)->(3,1,1,0)->(3,0,0,1)->(3,1,0,0)->(1,1,0,1)->(2,1,1,0)->(0,1,1,1)->(0,2,1,0)->(0,1,0,1)->(0,2,0,0)->(0,0,0,1)
Find one method! the number is 9
(3,2,1,0)->(3,1,0,1)->(3,2,0,0)->(3,0,0,1)->(3,1,0,0)->(1,1,0,1)->(2,1,1,0)->(0,1,1,1)->(0,2,1,0)->(0,0,1,1)->(1,0,1,0)->(0,0,0,1)
Find one method! the number is 10
(3,2,1,0)->(3,1,0,1)->(3,2,0,0)->(3,0,0,1)->(3,1,0,0)->(1,1,0,1)->(2,1,1,0)->(0,1,1,1)->(0,2,1,0)->(0,0,1,1)->(0,1,1,0)->(0,0,0,1)
Find one method! the number is 11
(3,2,1,0)->(3,1,0,1)->(3,2,0,0)->(3,0,0,1)->(3,1,0,0)->(1,1,0,1)->(2,1,1,0)->(0,1,1,1)->(0,2,1,0)->(0,1,0,1)->(1,1,0,0)->(0,0,0,1)
Find one method! the number is 12
(3,2,1,0)->(3,1,0,1)->(3,2,0,0)->(3,0,0,1)->(3,1,0,0)->(1,1,0,1)->(2,1,1,0)->(0,1,1,1)->(0,2,1,0)->(0,1,0,1)->(0,2,0,0)->(0,0,0,1)
Find one method! the number is 13
(3,2,1,0)->(2,2,0,1)->(3,2,0,0)->(3,0,0,1)->(3,1,0,0)->(1,1,0,1)->(2,1,1,0)->(0,1,1,1)->(0,2,1,0)->(0,0,1,1)->(1,0,1,0)->(0,0,0,1)
Find one method! the number is 14
(3,2,1,0)->(2,2,0,1)->(3,2,0,0)->(3,0,0,1)->(3,1,0,0)->(1,1,0,1)->(2,1,1,0)->(0,1,1,1)->(0,2,1,0)->(0,0,1,1)->(0,1,1,0)->(0,0,0,1)
Find one method! the number is 15
(3,2,1,0)->(2,2,0,1)->(3,2,0,0)->(3,0,0,1)->(3,1,0,0)->(1,1,0,1)->(2,1,1,0)->(0,1,1,1)->(0,2,1,0)->(0,1,0,1)->(1,1,0,0)->(0,0,0,1)
Find one method! the number is 16
(3,2,1,0)->(2,2,0,1)->(3,2,0,0)->(3,0,0,1)->(3,1,0,0)->(1,1,0,1)->(2,1,1,0)->(0,1,1,1)->(0,2,1,0)->(0,1,0,1)->(0,2,0,0)->(0,0,0,1)
Complete!
16 methods have been found!