Skip to content
Snippets Groups Projects
Commit bc1e7b11 authored by Brady James Garvin's avatar Brady James Garvin
Browse files

Recorded work from Monday.

parent 9daf6fba
No related branches found
No related tags found
No related merge requests found
...@@ -122,8 +122,8 @@ Problem: [same as above] ...@@ -122,8 +122,8 @@ Problem: [same as above]
## Choosing a Forward Edge ## Choosing a Forward Edge
* Exhaustive search: * Exhaustive search:
* Generate * Generate all following locations out to a distance of `range` as long as we don't go past the final destination
* Check that * Check that the chosen destination maximizes distance travelled (always favors the candidate)
## Example ## Example
...@@ -139,12 +139,15 @@ Problem: [same as above] ...@@ -139,12 +139,15 @@ Problem: [same as above]
Location Next Location Location Next Location
-------- ------------- -------- -------------
a … a c
c d
d e
e h
h i
Path Path
---- ----
a → a → c → d → e → h → i
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
......
...@@ -7,7 +7,16 @@ export function planFuelings(gaps, range) { ...@@ -7,7 +7,16 @@ export function planFuelings(gaps, range) {
gaps.every((gap) => gap <= range), gaps.every((gap) => gap <= range),
`Tried to find a fueling plan crossing a gap longer than the range ${range}.`, `Tried to find a fueling plan crossing a gap longer than the range ${range}.`,
); );
const results = []; const results = [0];
// TODO: stub const destination = gaps.length;
while (results[results.length - 1] < destination) {
let best = undefined;
for (let distance = , candidate = ;
distance < && candidate < ;
distance += , candidate += ) {
best = candidate;
}
results.push(best);
}
return results; return results;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment