better UX for boats

This commit is contained in:
evanpelle
2024-08-29 20:04:29 -07:00
parent 7b8c5c11dd
commit c8518ce30b
9 changed files with 72 additions and 38 deletions
+1 -1
View File
@@ -160,7 +160,7 @@ export class AStar {
compute(iterations: number): boolean {
if (this.completed) return true;
while (!this.openSet.size()) {
while (!this.openSet.isEmpty()) {
iterations--
this.current = this.openSet.dequeue()!.tile;
if (iterations <= 0) {
+2 -2
View File
@@ -1,7 +1,7 @@
import {Cell, Game} from "../Game";
import {PseudoRandom} from "../PseudoRandom";
import {SpawnIntent} from "../Schemas";
import {bfs} from "../Util";
import {bfs, dist as dist} from "../Util";
import {getSpawnCells} from "./Util";
@@ -40,7 +40,7 @@ export class BotSpawner {
spawnBot(botName: string): SpawnIntent {
const rand = this.random.nextInt(0, this.numFreeTiles);
const spawn = this.freeTiles[rand];
bfs(this.gs.tile(spawn), 50).forEach(t => this.removeCell(t.cell()))
bfs(this.gs.tile(spawn), dist(50)).forEach(t => this.removeCell(t.cell()))
const spawnIntent: SpawnIntent = {
type: 'spawn',
name: botName,