Ensure the ZZZZ magic word is reproducible.
authorJason S. Ninneman <jsn@mbar.us>
Fri, 26 May 2017 23:34:16 +0000 (16:34 -0700)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 23 Mar 2023 15:28:53 +0000 (11:28 -0400)
This happens by making the SEED command also regenerate the magic word.

main.c
tests/dwarf.chk
tests/dwarf.log [new file with mode: 0644]

diff --git a/main.c b/main.c
index 5a7c523a25963343c8ba17cd56dd9a1c8084e4ec..271e8a7005a4f00efbfbcf47cb6088ad4dd747c0 100644 (file)
--- a/main.c
+++ b/main.c
@@ -148,6 +148,8 @@ static bool fallback_handler(signed char *buf)
     if (sscanf(buf, "seed %ld", &sv) == 1) {
        set_seed(sv);
        printf("Seed set to %ld\n", sv);
+       // here we reconfigure any global game state that uses random numbers
+       ZZWORD=RNDVOC(3,0)+MESH*2;
        return true;
     }
     return false;
index fcf3a1e5c09f7e749b20b807ac304874e0293fc2..2f7f6d7ec7531afd72c0f7648efea6adff4d8c0d 100644 (file)
@@ -7,6 +7,7 @@ You are standing at the end of a road before a small brick building.
 Around you is a forest.  A small stream flows out of the building and 
 down a gully.  
 
+<<<<<<< HEAD
 > seed 1495763690
 Seed set to 1495763690
 
@@ -14,6 +15,10 @@ You're in front of building.
 
 > seed 1495752222
 Seed set to 1495752222
+=======
+> seed 1494912171
+Seed set to 1494912171
+>>>>>>> f9eca41 (Ensure the ZZZZ magic word is reproducible.)
 
 You're in front of building.  
 
diff --git a/tests/dwarf.log b/tests/dwarf.log
new file mode 100644 (file)
index 0000000..b50a35f
--- /dev/null
@@ -0,0 +1,59 @@
+## Death by dwarf.
+n
+seed 1494912171
+in
+take keys
+take lamp
+out
+down
+s
+s
+open grate
+down
+west
+take cage
+west
+light lamp
+take rod
+xyzzy
+xyzzy
+west
+drop rod
+west
+take bird
+east
+take rod
+west
+west
+down
+south
+take gold
+n
+n
+drop bird
+west
+take coins
+e
+s
+drop cage
+take jewelry
+take axe
+n
+n
+n
+plugh
+inven
+drop jewelry
+drop gold
+inven
+drop keys
+plugh
+s
+s
+up
+w
+wave rod
+w
+take diamonds
+e
+n