tessellatron
Advanced tools
Comparing version 0.4.3 to 0.4.4
{ | ||
"name": "tessellatron", | ||
"version": "0.4.3", | ||
"version": "0.4.4", | ||
"description": "Tessellatron creates graphs (represented by json structures) with tesselating spacial patterns.", | ||
@@ -26,7 +26,10 @@ "keywords": [ | ||
"dependencies": {}, | ||
"devDependencies": {}, | ||
"devDependencies": { | ||
"chai": "^4.2.0", | ||
"mocha": "^8.2.1" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"test": "mocha './src/**/*.test.js' --recursive", | ||
"start": "node ./src/main.js" | ||
} | ||
} |
@@ -94,3 +94,8 @@ import Cell from '../cell.js' | ||
// the app gets both from magnitudes. | ||
// this special `ordinals` array relates to antipodes. | ||
// its important just in case some of the dimensions are valued at 1. | ||
this.ordinals = [] | ||
// the app gets all three from magnitudes. | ||
for (let dg = 0; dg < this.degree; dg++) { | ||
@@ -116,2 +121,3 @@ | ||
this.antipodes[positive] = negative | ||
this.ordinals.push(new Set([positive, negative])) | ||
} | ||
@@ -259,17 +265,31 @@ | ||
// set up loop over the keys and values of rose. | ||
const entries = Object.entries(this.compass) | ||
for (const [direction, modifier] of entries) { | ||
// track all modifiers used in the loop. | ||
let usedModifiers = new Set() | ||
// calculate potential neighbor via modifier. | ||
const id02 = id01 + modifier | ||
// set up loop over the directions via opposite-ordinals. | ||
// bigger-magnitude directions come first. | ||
for (const directions of [...this.ordinals].reverse()) { | ||
for (const direction of directions) { | ||
const modifier = this.compass[direction] | ||
// ensure both IDs are valid, and add to neighbors. | ||
if (this.holdsNeighbors(id01, id02)) { | ||
neighbors[direction] = id02 | ||
// calculate potential neighbor via modifier. | ||
const id02 = id01 + modifier | ||
// if they are not, then the neighbor is void. | ||
// id01 must be a corner- or edge-piece. | ||
} else { | ||
neighbors[direction] = null | ||
// skip any "stale" modifiers. | ||
// it happens with dimensions of length one! | ||
if (usedModifiers.has(modifier)) { | ||
neighbors[direction] = null | ||
} | ||
// ensure both IDs are valid, and add to neighbors. | ||
else if (this.holdsNeighbors(id01, id02)) { | ||
neighbors[direction] = id02 | ||
usedModifiers.add(modifier) | ||
} | ||
// if they are not, then the neighbor is void. | ||
// id01 must be a corner- or edge-piece. | ||
else { | ||
neighbors[direction] = null | ||
} | ||
} | ||
@@ -276,0 +296,0 @@ } |
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
30335
9
622
1
2