digitsensitive / astar-typescript

A* search algorithm in TypeScript
MIT License
87 stars 18 forks source link

It doesn't seems to work as expected #8

Closed ferama closed 4 years ago

ferama commented 4 years ago

I'm having some issue experimenting with the library. This is what I'm trying to do:

import { AStarFinder } from "astar-typescript"
let astar = new AStarFinder({
    grid: {
        width: 8,
        height: 8
    },
})
let startPos = {x: 0, y: 0}
let goalPos = {x: 3, y: 7}
let myPathway = astar.findPath(startPos, goalPos)
console.log(myPathway)

Thet output is:

Cannot read property '7' of undefined

It works if

goalPos = {x: 2, y:7}

I'm missing something?

digitsensitive commented 4 years ago

Hello @ferama Are you using the newest version of the library (1.1.9, https://www.npmjs.com/package/astar-typescript)? Can you please post an online example of your code with the undefined output f.e. on https://jsfiddle.net? I was not able to reproduce your error.

ferama commented 4 years ago

It's weird. I started a project from scratch and it seems to work now. Don't know what happened into the previous one, so please ignore this issue and thanks :)