summaryrefslogtreecommitdiff
path: root/src/genome/genome.test.js
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-10-13 12:36:51 -0500
committersanine <sanine.not@pm.me>2023-10-13 12:36:51 -0500
commitac0e4eb51ca2fd595814031087039932729199ae (patch)
tree10e0d3aea2264f680ce239944226cd5d54564069 /src/genome/genome.test.js
parente257d91ac1a9504a4f058c124fe315034fae2b10 (diff)
implement genome parsing
Diffstat (limited to 'src/genome/genome.test.js')
-rw-r--r--src/genome/genome.test.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/genome/genome.test.js b/src/genome/genome.test.js
index 0ad8d80..8152f04 100644
--- a/src/genome/genome.test.js
+++ b/src/genome/genome.test.js
@@ -3,6 +3,7 @@
import {
mutation_type, mutate,
get_size,
+ parse_genome,
} from './genome';
@@ -32,5 +33,18 @@ test('genome validation and size', () => {
test('parse a genome into a neural net', () => {
-
+ const n = parse_genome(1, 1, [
+ [0, 1, 1],
+ [1, 1, 1],
+ [1, 2, 1]
+ ]);
+
+ console.log(n);
+
+ expect(n.input_count).toBe(1);
+ expect(n.output_count).toBe(1);
+ expect(n.compute([2], [-1])).toEqual([
+ [ Math.tanh( Math.tanh( 2-1 ) ) ],
+ [ Math.tanh( 2-1 ) ],
+ ]);
});