Exemple #1
0
int main(int argc, char **argv) {
    int opt;
    int use_var = 0;
    const char *pattern = "/files//*";
    struct timeval stop, start;

    while ((opt = getopt(argc, argv, "n")) != -1) {
        switch (opt) {
        case 'n':
            use_var = 1;
            break;
        default:
            fprintf(stderr, "Usage: %s [-n] [pattern]\n", argv[0]);
            fprintf(stderr, "      without '-n', iterate matches\n");
            fprintf(stderr, "      with '-n', use a variable and aug_ns_*\n");
            exit(EXIT_FAILURE);
            break;
        }
    }

    struct augeas *aug = aug_init(NULL, NULL, 0);

    if (optind < argc)
        pattern = argv[optind];

    gettimeofday(&start, NULL);
    if (use_var) {
        dump_var(aug, pattern);
    } else {
        dump_match(aug, pattern);
    }
    gettimeofday(&stop, NULL);
    print_time_taken(&start, &stop);
    return 0;
}
int main(int argc, char *argv[])
{
	board_struct player_board;
	board_struct *final_board = NULL;

	full_empty hashing_array[VERY_LARGE_NUMBER] = {empty};

	success_failure success_index = unsuccessful;
	int row_coordinate, col_coordinate;
	clock_t start = clock();
	
	weighting_board pagoda_board;

	SDL_Simplewin sw;

	check_unsigned_long_long();

	check_input_arguments(argc, argv, &row_coordinate, &col_coordinate, &success_index);

	initialise_player_board(&player_board);

	initialise_pagoda_board(pagoda_board, row_coordinate, col_coordinate);

	if(success_index != successful){
		final_board = make_a_move(row_coordinate, col_coordinate, &player_board, &player_board, &success_index, hashing_array, pagoda_board);
	}
	else{
		final_board = &player_board;
	}

	print_time_taken(start);

	Neill_SDL_Init(&sw);

	if(success_index == successful || success_index == symmetric_successful){
		print_successful_boards(&player_board, &sw, row_coordinate, col_coordinate, success_index);
	}

	free_all_boards(final_board);

	atexit(SDL_Quit);

	return(0);
}
Exemple #3
0
int main()
{
    matrix_t mat_a, mat_b;
    matrix_t mat_c;
    struct timeval start_time, end_time;
    random_matrix(&mat_a, 4);
    random_matrix(&mat_b, 4);
    null_matrix(&mat_c, 4);
    print_matrix(mat_a);
    printf("\n");
    print_matrix(mat_b);
    printf("\n");
    print_matrix(mat_c);
    gettimeofday(&start_time, 0);
    matrix_multiplication(mat_a, mat_b, mat_c);
    gettimeofday(&end_time, 0);
    printf("Normal Multiplication\n");
    print_matrix(mat_c);
    print_time_taken(start_time, end_time);
    mat_c = set_zero(mat_c);
    mat_c = matrix_multiplication_strassen(mat_a, mat_b, mat_c, 2);
    printf("Strassen Multiplication\n");
    print_matrix(mat_c);
}