-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathd&cstrategymaking
More file actions
29 lines (18 loc) · 1.09 KB
/
d&cstrategymaking
File metadata and controls
29 lines (18 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Initial DIVIDE & CONQUER Strategy:
At each CPU turn, the problem of selecting the optimal next move is divided into smaller independent subproblems.
We do this by splitting the set of all candidate neighboring cells into smaller subsets. Each subset is
recursively evaluated and sorted based on manhattan distance to the goal.
The solutions of these subproblems are finally combined to obtain a ordered list of candidate moves, from which the best feasible move is selected.
This strategy was changed to bfs. Our initial strategy was focused on locating coordinates, and using a base formula to find shortest path. However manhattan logic is only for vertical and horizontal paths and not diagonal.
We found a more optimal solution.
Purely recursive decomposition:
best = max(best, sub_score)
- depth limited
- recursive
- branching on neighbours
- combining with max
Initial DP Strategy:
Top-down dynamic programming:
Without DP, recursion will recompute identical states many times
The function evaluate_best_score runs twice.
KEY IDEA: BEFORE SOLVING A SUBPROBLEM, CHECK IF WE HAVE ALREADY SOLVED IT.