summaryrefslogtreecommitdiff
path: root/share/hackvr/examples
diff options
context:
space:
mode:
authorepoch <epoch@hacking.allowed.org>2019-06-10 02:58:53 -0500
committerepoch <epoch@hacking.allowed.org>2019-06-10 02:58:53 -0500
commit1b9820612a98f266bb90635c60c40943697826ee (patch)
treef64f0dfa3464f683ee4bbb17f663dbacadbc5ae6 /share/hackvr/examples
parentad8968436862baaa452f8da2b779aae694b1971e (diff)
downloadhackvr-1b9820612a98f266bb90635c60c40943697826ee.tar.gz
hackvr-1b9820612a98f266bb90635c60c40943697826ee.zip
added ability to set seed in dungen and commented out sleep that was used for watching the generating
Diffstat (limited to 'share/hackvr/examples')
-rwxr-xr-xshare/hackvr/examples/dungen/dungenbin17176 -> 0 bytes
-rw-r--r--share/hackvr/examples/dungen/dungen.c13
2 files changed, 11 insertions, 2 deletions
diff --git a/share/hackvr/examples/dungen/dungen b/share/hackvr/examples/dungen/dungen
deleted file mode 100755
index 1fc1c76..0000000
--- a/share/hackvr/examples/dungen/dungen
+++ /dev/null
Binary files differ
diff --git a/share/hackvr/examples/dungen/dungen.c b/share/hackvr/examples/dungen/dungen.c
index 0ea4906..10f92d3 100644
--- a/share/hackvr/examples/dungen/dungen.c
+++ b/share/hackvr/examples/dungen/dungen.c
@@ -1,4 +1,8 @@
#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <time.h>
#define ITERATIONS 16
@@ -52,8 +56,12 @@ void grow() {
int main(int argc,char *argv[]) {
int i;
+ int seed=time(0) * getpid();
+ if(argc > 1) {
+ seed=atoi(argv[1]);
+ }
printf("\x1b[H\x1b[2J");
- srandom(time(0) * getpid());
+ srandom(seed);
a[0x0]=" ";
a[0x1]="- ";
a[0x2]=" -";
@@ -74,9 +82,10 @@ int main(int argc,char *argv[]) {
field[7+16] = 0x4;//center top
for(i=0;i<ITERATIONS;i++) {
print_field();
- sleep(1);
+// sleep(1);
grow();
}
prune();
print_field();
+ printf("seed: %d\n",seed);
}