GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - devlsh/astar: A* pathfinding for 2D grids with elevation support.

BranchesTags
Open more actions menu

Latest commit

 

History

38 Commits
38 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.openchamber
.openchamber
 
 
.vscode
.vscode
 
 
bench
bench
 
 
demo
demo
 
 
docs
docs
 
 
src
src
 
 
tests
tests
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
.manifest.json
.manifest.json
 
 
AGENTS.md
AGENTS.md
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
bench.config.ts
bench.config.ts
 
 
lefthook.yml
lefthook.yml
 
 
oxfmt.config.ts
oxfmt.config.ts
 
 
oxlint.config.ts
oxlint.config.ts
 
 
package.json
package.json
 
 
pnpm-lock.yaml
pnpm-lock.yaml
 
 
pnpm-workspace.yaml
pnpm-workspace.yaml
 
 
release.json
release.json
 
 
tsconfig.build.json
tsconfig.build.json
 
 
tsconfig.json
tsconfig.json
 
 
tsdown.config.ts
tsdown.config.ts
 
 
vitest.config.ts
vitest.config.ts
 
 

Repository files navigation

@devlsh/astar

A* pathfinding for 2D grids with elevation support.


NPM Downloads GitHub Stars Build Status Software License


  • Interactive demo.
  • A* pathfinding on 2D grids.
  • Grids with numeric elevation values or configurable tile objects.
  • Optional diagonal movement and corner-cutting prevention.
  • Configurable maximum elevation change per move.
  • Includes built-in Diagonal and Manhattan heuristics, fully customizable.
  • Zero runtime dependencies.

Installation

$ npm install @devlsh/astar

Usage

Find a path from [0, 0] to [3, 3].

import { search, type Grid } from '@devlsh/astar';

/**
 * Numbers >= 0 specify elevation.
 *
 * 0 = ground
 * -1 = blocked/no tile
 * >= 1 = elevated tile
 */
const grid: Grid = [
  [0, 0, 0, 0],
  [0, -1, -1, 1],
  [0, 0, 1, 1],
  [0, 0, 1, 2],
];

const path = search({
  grid,

  // Coordinates are `[x, y]` vectors.
  from: [0, 0],
  to: [3, 3],

  // Maximum elevation change per move.
  stepHeight: 1,

  diagonal: true,
  cutCorners: false,
});

/**
 * The path includes both endpoints.
 * If no path is found, the result is null.
 */
console.log(path);

Contributing

Report bugs through issues or ask questions in Discussions. Report vulnerabilities privately as described in SECURITY.md.

For local development, pull requests, and other contributions, see the Contributing Guidelines.

License

@devlsh/astar is free and open-source software licensed under the MIT License.


devlsh.com  ·  GitHub: @devlsh  ·  X: @itsdevlsh

About

A* pathfinding for 2D grids with elevation support.

devlsh.com

Topics

2da-starastarelevationgridpathfindingtypescript

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity

Stars

13 stars

Watchers

1 watching

Forks

4 forks
Report repository

Releases

Sponsor this project

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.