示例#1
0
int main(){
   Puzzle sudoku;
   cin >> sudoku;
   cout << "Unsolved Puzzle:" << endl;
   sudoku.display();
   cout << endl;
   //Solve returns true if solved, false if not.
   if (sudoku.solve(0, 0)) {
      cout << "Solved Puzzle:" << endl;
      sudoku.display();
      cout << endl;
   }
   else {
      cout << "Puzzle is unsolvable." << endl;
   }
   return 0;
}
示例#2
0
int main(int argc, char** argv)
{
    Puzzle test;
    Puzzle fit;
    srand(time(NULL));

    cin >> test;
    GeneticAlgorithm tryit(test, atoi(argv[1]), atoi(argv[2]));
    //GeneticAlgorithm tryit(test, POPSIZE, MAXGENS);
    fit = tryit.evolve();
    fit.display();
    cout << "Fitness: " << fit.fitness() << endl;

    return (EXIT_SUCCESS);
}