function straight(originId, dir = null,  g = 0) {

    // Nodes exist and not a wall?
    if(!nodes[originId] || nodes[originId].wall()) {
        return;
    }

    let nextId = nodes[originId].neighbors[dir];

    if(!nodes[nextId] || nodes[nextId].wall()) {
        return;
    }

    // Add the specific dir
    // f calculated for the next node but search start from the origin
    let f = g + 1 + heuristics[mode](nextId, targetId);
    points.enqueue(new jpsPoint(originId, dir, g), f);

}
// the idea is handling all wall exceotions in these functions + all the kwa3
the idea is handling all wall exceotions in these functions + all the kwa3
the idea is handling all wall exceotions in these functions + all the kwa3
function straight(originId, dir = null,  g = 0) {
    if(!nodes[originId] || nodes[originId].wall()) {
        return;
    }
    let nextId = nodes[originId].neighbors[dir];
    if(!nodes[nextId] || nodes[nextId].wall()) {
        return;
    }
    let f = g + 1 + heuristics[mode](nextId, targetId);
    points.enqueue(new jpsPoint(originId, dir, g), f);
}
function straight ( originId , dir = null , g = 0 ) { if ( ! nodes [ originId ] || nodes [ originId ] . wall ( ) ) { return ; } let nextId = nodes [ originId ] . neighbors [ dir ] ; if ( ! nodes [ nextId ] || nodes [ nextId ] . wall ( ) ) { return ; } let f = g + 1 + heuristics [ mode ] ( nextId , targetId ) ; points . enqueue ( new jpsPoint ( originId , dir , g ) , f ) ; }
the idea is handling all wall exceotions in these functions + all the kwa3
the idea is handling all wall exceotions in these functions + all the kwa3
// Nodes exist and not a wall? // Add the specific dir // f calculated for the next node but search start from the origin