Exemple #1
0
int main(int argc, char const *argv[])
{
	/* Leemos la ciudad del input */
	Layout* layout = city_layout_read(stdin);

	/* Lo imprimimos para darle el estado inicial al watcher / judge */
	city_layout_print(layout);

	/* TODO RESOLVER PROBLEMA */
	Master* m = create_master(layout);
	ordenar_colores(m->t);
	juntar_lineas_por_color(m);
	set_lines_goals(m->t);
	solve_puzzle(m, 'l');
	print_telar(m->t);
	tejer(m);

	/* TODO IMPRIMIR DECISIONES */

	print_solucion_output(m->s);
	/* Indicamos al watcher y al judge que ya terminamos */	
	printf("END\n");

	/* Liberamos memoria */
	city_layout_destroy(layout);

	return 0;
}
Exemple #2
0
int
main()
{
    int size = SIZE;
    int **arr;

    if (SIZE > MAX_SIZE) {
        printf("Unsupported size %d. Max supported = %d\n", SIZE,
               MAX_SIZE);
    }
    if (NUM_EP > SIZE) {
        printf("Number of endpoints %d greater than grid size %d\n",
               NUM_EP, SIZE);
    }

    arr = alloc_n_by_n_array(size);
    initialize_arr(arr, size);
    setup_puzzle(ref_arr, arr, size);

    printf("Problem:\n");
    printf("===============\n");
    print_arr(arr, size);

    printf("\nSolutions: \n");
    printf("===============\n");
    failure_count = 0;
    solution_count = 0;

    solve_puzzle(arr, size);
    printf("\nCompletions but no array full = %d\n", failure_count);
    printf("\nSolution count = %d\n", solution_count);
    print_cc();
}
int main()
{
    int exit = 0;
    exit = read_sudoku();
    exit = solve_puzzle();
    exit = check_validity_of_proposed_solution();
    return exit;
}