summaryrefslogtreecommitdiff
path: root/src/genome/genome.js
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-10-30 01:00:53 -0500
committersanine <sanine.not@pm.me>2023-10-30 01:00:53 -0500
commit17fc9fe64f4de1bc58596034c54ddb487f992c9f (patch)
treea71e5e706dcec5364e51c235603a776e52d1dac6 /src/genome/genome.js
parent9fbeab4652b075fb545cbe54984a91f91be1d627 (diff)
add mut_genome_delete
Diffstat (limited to 'src/genome/genome.js')
-rw-r--r--src/genome/genome.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/genome/genome.js b/src/genome/genome.js
index d35b68c..16b5e4d 100644
--- a/src/genome/genome.js
+++ b/src/genome/genome.js
@@ -120,3 +120,12 @@ export function mut_genome_insert(
[...genome, [source, sink, weight]],
];
}
+
+
+export function mut_genome_delete(
+ [n_input, n_internal, n_output, genome], r
+) {
+ const del_idx = Math.floor(r * genome.length);
+ const new_genome = genome.filter((_, idx) => idx != del_idx);
+ return [n_input, n_internal, n_output, new_genome];
+}