.pragma library
function htmlEscaped(str) {
str = str.replace(//g, ">");
return str
}
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) + min; //The maximum is exclusive and the minimum is inclusive
}
function mouseToGrid(x,y) {
return {"x":Math.floor(x/40), "y":Math.floor(y/40)}
}
function distance(a,b) {
let ax = Math.floor(a/16)
let ay = a%16
let bx = Math.floor(b/16)
let by = b%16
return Math.abs(ax-bx) + Math.abs(ay-by)
}
function scorePath(path) {
var pathLength = 0
for (var i=0;i {
map[key] = obj[key];
});
return map;
}
function isGroup(id) {
return id.length == 32
}
function isPeer(id) {
return id.length == 56
}