mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-14 13:24:41 +00:00
NPCs create battleships, destroyers. start work on miniastar
This commit is contained in:
@@ -3,7 +3,7 @@ import { AStar, SearchNode } from "./AStar";
|
||||
import { PathFindResultType } from "./AStar";
|
||||
|
||||
|
||||
export class SerialAStar implements AStar{
|
||||
export class SerialAStar implements AStar {
|
||||
private fwdOpenSet: PriorityQueue<{ tile: SearchNode; fScore: number; }>;
|
||||
private bwdOpenSet: PriorityQueue<{ tile: SearchNode; fScore: number; }>;
|
||||
private fwdCameFrom: Map<SearchNode, SearchNode>;
|
||||
@@ -17,7 +17,6 @@ export class SerialAStar implements AStar{
|
||||
private src: SearchNode,
|
||||
private dst: SearchNode,
|
||||
private canMove: (t: SearchNode) => boolean,
|
||||
private neighbors: (sn: SearchNode) => SearchNode[],
|
||||
private iterations: number,
|
||||
private maxTries: number
|
||||
) {
|
||||
@@ -85,7 +84,7 @@ export class SerialAStar implements AStar{
|
||||
}
|
||||
|
||||
private expandSearchNode(current: SearchNode, isForward: boolean) {
|
||||
for (const neighbor of this.neighbors(current)) {
|
||||
for (const neighbor of current.neighbors()) {
|
||||
if (neighbor !== (isForward ? this.dst : this.src) && !this.canMove(neighbor)) continue;
|
||||
|
||||
const gScore = isForward ? this.fwdGScore : this.bwdGScore;
|
||||
|
||||
Reference in New Issue
Block a user