// Cloned by AncientBrain@123 on 1 Nov 2021 from World "Javascript" by javascript
// Please leave this clone trail here.
const c = 3;
var v = 5;
let l = 6;
function sumNum(a, b) {
return a+b;
}
let f = function(){
return 'hello';
}
let f2 = (a, b) => {a+b}
class Person{
constructor(name, surname){
this.name = name;
this.surname = surname;
}
getName(){
return this.name;
}
}
let GRID = [
[1,1,1,1,1,1,1],
[1,0,0,0,0,0,1],
[1,0,0,0,0,0,1],
[1,0,0,0,0,0,1],
[1,0,0,0,0,0,1],
[1,0,0,0,0,0,1],
[1,1,1,1,1,1,1],
];
function printGrid() {
let s = '';
for(let i = 0; i < GRID.length; i++) {
for(let j= 0; j < GRID[i].length; j++) {
if(i == ei && j == ej){
s += 'E ';
}else if(ai == i && aj == j) {
s += 'A ';
}
else s += GRID[i][j] + ' ';
}
s += '\n';
}
console.log(s);
}
let ei = 1, ej = 2, ai = 3, aj = 5;
class Nodelist{
constructor(){
this.list = [];
}
add(node){
this.list.push(node);
}
getNextNode(){
let min = this.list[0].cost;
let selected = 0;
for(let i in this.list) {
if(this.list[i].cost < min){
min = this.list[i].cost;
selected = i;
}
}
return this.list.splice(selected, 1)[0];
}
}
function createNode(coordI, coordJ, parent){
let newNode = new Node(coordI, coordJ, parent);
}
class Node{
constructor(coordI, coordJ, parent){
this.coordI = coordI;
this.coordJ = coordJ;
this.parent = parent;
this.depth = parent.depth + 1;
this.cost = this.depth + heuristic(coordI, coordJ, ai, aj);
}
getNextChildren() {
}
}
function search(iStart, jStart, iEnd, jEnd){
let next = nodelist.getNextNode();
while(!isGoal(next)){
expand(next);
next = nodelist.getNextNode();
}
}