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