aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/evolver.h1
-rw-r--r--src/evolver.c11
-rw-r--r--tsalis/README.md1
-rw-r--r--tsalis/bin/.keep0
-rw-r--r--tsalis/bin/genomes/32shftr.anc1
-rw-r--r--tsalis/bin/genomes/55.anc1
-rw-r--r--tsalis/src/handler.c10
7 files changed, 25 insertions, 0 deletions
diff --git a/include/evolver.h b/include/evolver.h
index 15a4f64..b8955f1 100644
--- a/include/evolver.h
+++ b/include/evolver.h
@@ -12,6 +12,7 @@ sbyte se_getLastInst (void);
sword se_getState (sword eidx);
void se_setState (sword eidx, sword state);
+void se_randomize (void);
void se_cycle (void);
#endif
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);
diff --git a/tsalis/README.md b/tsalis/README.md
index 214e3b9..abfe188 100644
--- a/tsalis/README.md
+++ b/tsalis/README.md
@@ -60,6 +60,7 @@ control some aspects of the simulation. Parameters here are represented by
|s |--- |--- |Save simulation. |
|r*XX* |name |--- |Rename simulation (will be automatically saved to this name on exit). |
|a*XX* |interval |--- |Set simulation's auto-save interval. |
+|? |--- |--- |Fill memory with random data. |
### Legend
In WORLD view, as well as in PROCESS view (when gene mode is selected), each
diff --git a/tsalis/bin/.keep b/tsalis/bin/.keep
deleted file mode 100644
index e69de29..0000000
--- a/tsalis/bin/.keep
+++ /dev/null
diff --git a/tsalis/bin/genomes/32shftr.anc b/tsalis/bin/genomes/32shftr.anc
new file mode 100644
index 0000000..756bd9c
--- /dev/null
+++ b/tsalis/bin/genomes/32shftr.anc
@@ -0,0 +1 @@
+A[a1u<<<<<}02B.13:23^1^2v?(b$(a
diff --git a/tsalis/bin/genomes/55.anc b/tsalis/bin/genomes/55.anc
new file mode 100644
index 0000000..ca02b65
--- /dev/null
+++ b/tsalis/bin/genomes/55.anc
@@ -0,0 +1 @@
+A[a]a1^1-11B!3#1#3?3)c{12)dC}12D.03:23^^2v1?1(d$~3~1(bA
diff --git a/tsalis/src/handler.c b/tsalis/src/handler.c
index 21aa706..a0730ad 100644
--- a/tsalis/src/handler.c
+++ b/tsalis/src/handler.c
@@ -141,6 +141,12 @@ setAutoSave(const char *command)
}
static void
+randomize(void)
+{
+ se_randomize();
+}
+
+static void
clearConsoleLine(void)
{
move(LINES - 1, 0);
@@ -200,6 +206,10 @@ runConsole(void)
case 'a':
setAutoSave(&command[1]);
break;
+
+ case '?':
+ randomize();
+ break;
}
}