@thi.ng/cellular 0.2.108 → 0.2.110
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/1d.js +6 -12
- package/CHANGELOG.md +1 -1
- package/README.md +1 -1
- package/package.json +12 -12
package/1d.js
CHANGED
|
@@ -95,8 +95,7 @@ class MultiCA1D {
|
|
|
95
95
|
const [dest, num] = this._getTarget(target);
|
|
96
96
|
const fn = target === "prob" ? () => rnd.float() : () => rnd.int() % num;
|
|
97
97
|
for (let x = 0, width = this.width; x < width; x++) {
|
|
98
|
-
if (rnd.probability(prob))
|
|
99
|
-
dest[x] = fn();
|
|
98
|
+
if (rnd.probability(prob)) dest[x] = fn();
|
|
100
99
|
}
|
|
101
100
|
return this;
|
|
102
101
|
}
|
|
@@ -142,15 +141,11 @@ class MultiCA1D {
|
|
|
142
141
|
const k = kernel[i];
|
|
143
142
|
let xx = x + k[0];
|
|
144
143
|
if (wrap) {
|
|
145
|
-
if (xx < 0)
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
xx -= width;
|
|
149
|
-
} else if (xx < 0 || xx >= width)
|
|
150
|
-
continue;
|
|
144
|
+
if (xx < 0) xx += width;
|
|
145
|
+
else if (xx >= width) xx -= width;
|
|
146
|
+
} else if (xx < 0 || xx >= width) continue;
|
|
151
147
|
const y = k[1];
|
|
152
|
-
if (y >= 0 && gens[1 + y][xx] !== 0)
|
|
153
|
-
sum += weights[i];
|
|
148
|
+
if (y >= 0 && gens[1 + y][xx] !== 0) sum += weights[i];
|
|
154
149
|
}
|
|
155
150
|
return rule & $1 << sum ? fn(val) : 0;
|
|
156
151
|
}
|
|
@@ -234,8 +229,7 @@ const randomRule1D = (kernelSize, rnd = SYSTEM) => {
|
|
|
234
229
|
for (let i = $0; i < n; i += $32) {
|
|
235
230
|
id <<= $32;
|
|
236
231
|
let mask = n - i;
|
|
237
|
-
if (mask > $32)
|
|
238
|
-
mask = $32;
|
|
232
|
+
if (mask > $32) mask = $32;
|
|
239
233
|
id |= BigInt(rnd.int()) & ($1 << mask) - $1;
|
|
240
234
|
}
|
|
241
235
|
return id;
|
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/cellular",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.110",
|
|
4
4
|
"description": "Highly customizable 1D cellular automata, shared env, multiple rules, arbitrary sized/shaped neighborhoods, short term memory, cell states etc.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -36,18 +36,18 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.11.
|
|
40
|
-
"@thi.ng/arrays": "^2.9.
|
|
41
|
-
"@thi.ng/checks": "^3.6.
|
|
42
|
-
"@thi.ng/errors": "^2.5.
|
|
43
|
-
"@thi.ng/random": "^3.
|
|
44
|
-
"@thi.ng/transducers": "^9.0.
|
|
39
|
+
"@thi.ng/api": "^8.11.2",
|
|
40
|
+
"@thi.ng/arrays": "^2.9.6",
|
|
41
|
+
"@thi.ng/checks": "^3.6.4",
|
|
42
|
+
"@thi.ng/errors": "^2.5.7",
|
|
43
|
+
"@thi.ng/random": "^3.8.0",
|
|
44
|
+
"@thi.ng/transducers": "^9.0.5"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@microsoft/api-extractor": "^7.43.
|
|
48
|
-
"esbuild": "^0.
|
|
49
|
-
"typedoc": "^0.25.
|
|
50
|
-
"typescript": "^5.4.
|
|
47
|
+
"@microsoft/api-extractor": "^7.43.2",
|
|
48
|
+
"esbuild": "^0.21.1",
|
|
49
|
+
"typedoc": "^0.25.13",
|
|
50
|
+
"typescript": "^5.4.5"
|
|
51
51
|
},
|
|
52
52
|
"keywords": [
|
|
53
53
|
"1d",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
],
|
|
95
95
|
"year": 2022
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
|
|
98
98
|
}
|