wip
This commit is contained in:
parent
df0d7b92a3
commit
bc6b5259c1
@ -1,6 +1,11 @@
|
|||||||
import * as R from "remeda";
|
import * as R from "remeda";
|
||||||
import u from "updeep";
|
import u from "updeep";
|
||||||
|
|
||||||
|
import Graph from 'graphology';
|
||||||
|
import {bidirectional} from 'graphology-shortest-path';
|
||||||
|
|
||||||
|
import { combinations } from "combinatorial-generators";
|
||||||
|
|
||||||
import { readFile } from "../05/part1.js";
|
import { readFile } from "../05/part1.js";
|
||||||
|
|
||||||
const parseLine = (line) => {
|
const parseLine = (line) => {
|
||||||
@ -62,5 +67,12 @@ function bestMoveFor(tunnels,minutesLeft,opened,location='AA',totalSteam=0,activ
|
|||||||
|
|
||||||
|
|
||||||
export default (tunnels) => {
|
export default (tunnels) => {
|
||||||
return bestMoveFor(tunnels,30,[]);
|
|
||||||
|
const graph = new Graph();
|
||||||
|
Object.entries(tunnels).forEach( ([location, { exits }]) => {
|
||||||
|
exits.forEach( exit => graph.addEdge(location, exit) );
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(graph);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user