aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2024-02-29 01:50:44 +0100
committerPaul Oliver <contact@pauloliver.dev>2024-02-29 01:50:44 +0100
commit7b21c44c67b1b61d4606205219264f084fab07ea (patch)
tree82ec242e4247389d9d5006c57ee7319da49b7bf3 /src
parent2dc9d118efb64de6ea54a5a9eb4474f8e5ef3145 (diff)
Added randomize command. Added ancestors.
Diffstat (limited to 'src')
-rw-r--r--src/evolver.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/evolver.c b/src/evolver.c
index ba043a3..d72f38b 100644
--- a/src/evolver.c
+++ b/src/evolver.c
@@ -113,6 +113,17 @@ generateRandomNumber(void)
}
void
+se_randomize(void)
+{
+ sword addr;
+ assert(g_isInit);
+
+ for (addr = 0; addr < sm_getSize(); addr++) {
+ sm_setInstAt(addr, (sbyte)(generateRandomNumber() % SINST_COUNT));
+ }
+}
+
+void
se_cycle(void)
{
assert(g_isInit);