Try with branch caching again
This commit is contained in:
@@ -106,8 +106,6 @@ for (let y = 1; y < height - 1; y++) {
|
||||
|
||||
let fastest: number|null = null;
|
||||
|
||||
const scoreCache: { [key: string]: [number, Coord, Dir] } = {};
|
||||
|
||||
const branchCache: { [key: string]: number } = {};
|
||||
|
||||
const scores: Array<[number, Array<string>]> = [];
|
||||
@@ -125,9 +123,6 @@ function getScoresAfterPosition(pos: Coord, dir: Dir, currentScore = 0, path: Ar
|
||||
} else {
|
||||
branchCache[cacheKey] = currentScore;
|
||||
}
|
||||
if (lastBranch) {
|
||||
scoreCache[`${lastBranch[1].x},${lastBranch[1].y}`] = [currentScore - lastBranch[0], pos, dir];
|
||||
}
|
||||
lastBranch = [currentScore, pos];
|
||||
}
|
||||
[dir, nextDir(dir), prevDir(dir)].forEach((newDir, i) => {
|
||||
|
||||
Reference in New Issue
Block a user