Example #1
0
void run (int height_coordinate, int width_coordinate){

    move *moves_array = create_move_array (MOVES_MAX);
    Node *final_board, *start;
    int move_count = 0, target_found = 0;
    int initial_board [BOARD_HEIGHT][BOARD_WIDTH];

    populate_board (initial_board);
    start = allocate_start_node (initial_board);
    target_found = check_for_target (initial_board, height_coordinate, width_coordinate);

    if (!target_found){
        final_board = find_solution (start, height_coordinate, width_coordinate);
        move_count = populate_moves_array (final_board, moves_array);
        //to copy start board into last element of moves array for printing
        copy_board ((moves_array+(move_count-1))->board, start->board);
        print_moves_SDL (moves_array, move_count);
        // print_moves (moves_array, move_count);
    }

    else {
        print_list_SDL (start);
        printf("Target already on board\n");
    }

    // print_list(start);

    free_list (start);
    free (moves_array);
}
Example #2
0
    AttackPattern(std::vector<vec2>* hits, Opponent* o) {
	memset(grid, 0, 400);
	this->hits = hits;
	this->o = o;

	hit_index = 0;
	miss_index = 0;

	my_misses = 0 - o->initial_misses();
	my_hits = 0;
	shot_count = 0;

	dir = UP;
	sequence_hits = 0;

	populate_board();
    }