This commit is contained in:
nim-ka
2021-12-29 03:53:12 -05:00
parent c570cae378
commit 630f3a46a8
8 changed files with 6 additions and 30 deletions

View File

@@ -58,5 +58,3 @@ class BinHeap {
} }
} }
window.BinHeap = BinHeap

2
dll.js
View File

@@ -170,5 +170,3 @@ class DLL {
toString() { return this.toArray().toString() } toString() { return this.toArray().toString() }
} }
window.DLL = DLL

View File

@@ -5,8 +5,6 @@ class Cxn {
} }
} }
window.Cxn = Cxn
class SearchData { class SearchData {
constructor(id, dist = Infinity, last = undefined, custom = {}) { constructor(id, dist = Infinity, last = undefined, custom = {}) {
this.id = id this.id = id
@@ -39,8 +37,6 @@ class SearchData {
} }
} }
window.SearchData = SearchData
class Node { class Node {
static GLOBAL_ID = 0 static GLOBAL_ID = 0
@@ -134,5 +130,3 @@ class Node {
} }
} }
window.Node = Node

View File

@@ -176,5 +176,3 @@ class Grid {
print(sep = "\t", ...pts) { console.log(this.toString(sep, pts)) } print(sep = "\t", ...pts) { console.log(this.toString(sep, pts)) }
} }
window.Grid = Grid

18
out.js
View File

@@ -170,8 +170,6 @@ class DLL {
toString() { return this.toArray().toString() } toString() { return this.toArray().toString() }
} }
window.DLL = DLL
class Point { class Point {
constructor(x, y) { constructor(x, y) {
this.x = x this.x = x
@@ -231,7 +229,7 @@ class Point {
toString() { return this.x + "," + this.y } toString() { return this.x + "," + this.y }
} }
window.Pt = window.Point = Point Pt = Point
class Grid { class Grid {
constructor(w, h, fill = 0) { constructor(w, h, fill = 0) {
@@ -411,8 +409,6 @@ class Grid {
print(sep = "\t", ...pts) { console.log(this.toString(sep, pts)) } print(sep = "\t", ...pts) { console.log(this.toString(sep, pts)) }
} }
window.Grid = Grid
class BinHeap { class BinHeap {
constructor(cond = (p, c) => p < c) { constructor(cond = (p, c) => p < c) {
this.cond = cond this.cond = cond
@@ -473,8 +469,6 @@ class BinHeap {
} }
} }
window.BinHeap = BinHeap
class Cxn { class Cxn {
constructor(dest, weight = 1) { constructor(dest, weight = 1) {
this.dest = dest this.dest = dest
@@ -482,8 +476,6 @@ class Cxn {
} }
} }
window.Cxn = Cxn
class SearchData { class SearchData {
constructor(id, dist = Infinity, last = undefined, custom = {}) { constructor(id, dist = Infinity, last = undefined, custom = {}) {
this.id = id this.id = id
@@ -516,8 +508,6 @@ class SearchData {
} }
} }
window.SearchData = SearchData
class Node { class Node {
static GLOBAL_ID = 0 static GLOBAL_ID = 0
@@ -611,8 +601,6 @@ class Node {
} }
} }
window.Node = Node
Object.defineProperty(Object.prototype, "copyDeep", { Object.defineProperty(Object.prototype, "copyDeep", {
value: function() { value: function() {
return JSON.parse(JSON.stringify(this)) return JSON.parse(JSON.stringify(this))
@@ -715,7 +703,7 @@ class PointArray extends Array {
} }
} }
window.PtArray = window.PointArray = PointArray PtArray = PointArray
Object.defineProperty(Array.prototype, "pt", { Object.defineProperty(Array.prototype, "pt", {
get: function() { get: function() {
@@ -766,7 +754,7 @@ Object.defineProperties(PointArray.prototype, {
} }
}) })
window.utils = { utils = {
fetch: (url) => fetch(url).then(e => e.text()), fetch: (url) => fetch(url).then(e => e.text()),
fetchEval: (url) => utils.fetch(url).then(e => eval(e)), fetchEval: (url) => utils.fetch(url).then(e => eval(e)),
signAgnosticInclusiveRange: (a, b, s = Math.sign(a - b)) => Array((a - b) * s + 1).fill().map((_, i) => a - i * s), signAgnosticInclusiveRange: (a, b, s = Math.sign(a - b)) => Array((a - b) * s + 1).fill().map((_, i) => a - i * s),

View File

@@ -100,7 +100,7 @@ class PointArray extends Array {
} }
} }
window.PtArray = window.PointArray = PointArray PtArray = PointArray
Object.defineProperty(Array.prototype, "pt", { Object.defineProperty(Array.prototype, "pt", {
get: function() { get: function() {

2
pt.js
View File

@@ -57,5 +57,5 @@ class Point {
toString() { return this.x + "," + this.y } toString() { return this.x + "," + this.y }
} }
window.Pt = window.Point = Point Pt = Point

View File

@@ -1,4 +1,4 @@
window.utils = { utils = {
fetch: (url) => fetch(url).then(e => e.text()), fetch: (url) => fetch(url).then(e => e.text()),
fetchEval: (url) => utils.fetch(url).then(e => eval(e)), fetchEval: (url) => utils.fetch(url).then(e => eval(e)),
signAgnosticInclusiveRange: (a, b, s = Math.sign(a - b)) => Array((a - b) * s + 1).fill().map((_, i) => a - i * s), signAgnosticInclusiveRange: (a, b, s = Math.sign(a - b)) => Array((a - b) * s + 1).fill().map((_, i) => a - i * s),