int main(int argc, char** argv) { // // Load image // // Check input if (argc < 2) { std::cout << "ERROR: input filename missing or too many parameters" << std::endl; return 1; } // Save input file std::string inputFile = argv[1]; // Message std::cout << "NOTE: configured" << std::endl; // // Create environment // // Create object EnvImgWrite dataEnvironment; // Max time given? if (argc == 3) dataEnvironment.runtime(atoi(argv[2])); // Load base image if (!dataEnvironment.load(inputFile)) { std::cout << "ERROR: could not load image" << std::endl; return 1; } // Message std::cout << "NOTE: environment created" << std::endl; // // Create population // // Initial DNA (triangle) unsigned char dnastring[] = {50, 50, 50, 128, // Semi transparent grey brush (RGB = 50 50 50, with 50% opacity) 1, 254, // Point one: (1, 254) 128, 1, // Point two: (128, 1) 254, 254, // Point three: (254, 254) 0, // And a seperator for the next gene 255, 1, 1, 128, 25, 225, 225, 225, 225, 25, 25, 25}; DNA tempDNA(dnastring, 23); dataEnvironment.explain(&tempDNA); // Create object Population* dataPopulation = new PopSingleStraight(&dataEnvironment, tempDNA); // Message std::cout << "NOTE: population created" << std::endl; // Evolve try { dataPopulation->evolve(); } catch (std::string e) { std::cout << "ERROR: " << e << std::endl; } // Fetch and print the resulting DNA const DNA* outputDNA = dataPopulation->get(); dataEnvironment.explain(outputDNA); delete dataPopulation; return 0; }