本文整理汇总了C++中Puzzle::CreatePuzzle方法的典型用法代码示例。如果您正苦于以下问题:C++ Puzzle::CreatePuzzle方法的具体用法?C++ Puzzle::CreatePuzzle怎么用?C++ Puzzle::CreatePuzzle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Puzzle
的用法示例。
在下文中一共展示了Puzzle::CreatePuzzle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: return
int main(int argc, char **argv)
{
char Name = 'M';
std::string taq = "TaquinA5_2.txt";
if (argc == 3)
{
std::ifstream infile;
infile.open(argv[2]);
if (!infile.is_open())
{
std::cout << "Error: file <" << argv[2] << ">" << " not found" << std::endl;
return (-1);
}
infile.close();
taq = argv[2];
FileLoader F;
std::string S;
Puzzle P;
SolutionGenerator SG;
short unsigned int** Tab;
clock_t timeDeb, timeEnd;
std::list<Puzzle> OpenedList, ClosedList;
int x = 0, y = 0, fg = -42;
timeDeb = clock();
DisplayLogo();
F.LoadFile(taq.c_str(), S);
std::istringstream In(S);
P.SetAlgo(Name);
Tab = P.CreatePuzzle(S);
std::list<Puzzle>::iterator FirstPuzzle;
OpenedList.push_back(P);
while (fg != 0 && !OpenedList.empty())
{
FirstPuzzle = OpenedList.begin();
fg = Resume(FirstPuzzle, OpenedList, ClosedList, timeEnd);
ProcessUp(FirstPuzzle, OpenedList, ClosedList);
ProcessDown(FirstPuzzle, OpenedList, ClosedList);
ProcessRight(FirstPuzzle, OpenedList, ClosedList);
ProcessLeft(FirstPuzzle, OpenedList, ClosedList);
(*FirstPuzzle).ClearListTab();
ClosedList.push_back(*FirstPuzzle);
OpenedList.erase(FirstPuzzle);
}
if (fg != 0)
std::cout << "NO SOLUTION FOR THIS TAQUIN!!!" << std::endl;
std::cout << "CLOSED LIST NUMBER OF CONTENTS : \t\t[" << ClosedList.size() << "]"<< std::endl;
std::cout << "TIME ELAPSED : \t\t[" << static_cast<double>(timeEnd - timeDeb) << "] ms." << std::endl;
ShowNbMoves();
std::cout << "Cleaning..." << std::endl;
Clean(OpenedList, ClosedList);
std::cout << "Clean done" << std::endl;
}
return (0);
}