use mini a star for all pathfinding

This commit is contained in:
evanpelle
2024-12-03 15:06:55 -08:00
parent 4edd66dc1f
commit e6fa108eaa
7 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -42,8 +42,8 @@ export class MiniAStar implements AStar {
function upscalePath(path: Cell[], scaleFactor: number = 2): Cell[] {
// Scale up each point
const scaledPath = path.map(point => (new Cell(
point.x * scaleFactor,
point.y * scaleFactor
point.x * scaleFactor,
point.y * scaleFactor
)));
const smoothPath: Cell[] = [];
+2 -2
View File
@@ -1,6 +1,6 @@
import { Cell, Game, Tile } from "../game/Game";
import { manhattanDist } from "../Util";
import { AStar, PathFindResultType, TileResult } from "./AStar";
import { AStar, PathFindResultType, SearchNode, TileResult } from "./AStar";
import { ParallelAStar, WorkerClient } from "../worker/WorkerClient";
import { SerialAStar } from "./SerialAStar";
import { MiniAStar } from "./MiniAStar";
@@ -19,7 +19,7 @@ export class PathFinder {
) { }
public static Mini(game: Game, iterations: number, canMove: (t: Tile) => boolean, maxTries: number = 20) {
public static Mini(game: Game, iterations: number, canMove: (s: SearchNode) => boolean, maxTries: number = 20) {
return new PathFinder(
game,
(curr: Tile, dst: Tile) => {