int main(int argc, char** argv) { freopen("CON", "w", stdout); // redirects stdout because SDL redirects it to a file. /* Parsing the input parameters. */ if (argc < 6) { std::cout << "Missing some input parametr. Needed at least 5 but got only " << argc - 1 << std::endl; return -1; } if (!initGraphics(RESX, RESY)) return -1; renderScene(); displayVFB(vfb); try { Puzzle puzzle; if (!puzzle.loadMap(argv[1])) throw "Something is wrong with the map file!"; puzzle.setMonsterAndFoodCoords(fromStringToInt(argv[2]), fromStringToInt(argv[3]), fromStringToInt(argv[4]), fromStringToInt(argv[5])); // The flag for the SDL visualization if (argc >= 7) { puzzle.setVisualizationFlag(fromStringToInt(argv[6])); } // The flag for the SDL visualization if (argc >= 8) { puzzle.setDelay(fromStringToInt(argv[7])); } puzzle.printMap(std::cout); puzzle.solveAndVizualize(std::cout); puzzle.visualizeThePath(); puzzle.basicVisualizePath(std::cout); puzzle.printFormatedPath(std::cout); } catch (const char * msg) { std::cout << "Error: " << msg << std::endl; } catch (const string msg) { std::cout << "Error: " << msg << std::endl; } waitForUserExit(); closeGraphics(); return 0; }