Skip to content

Commit e289b49

Browse files
committed
If the puzzle is "unknownpuzzle", output a full hash including both
the puzzle definition and the options.
1 parent 9c646a1 commit e289b49

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/cpp/prunetable.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,13 @@ void prunetable::checkextend(const puzdef &pd, int ignorelookup) {
371371
// if someone set options that affect the hash, we add a suffix to the
372372
// data file name to reflect this.
373373
void prunetable::addsumdat(const puzdef &pd, string &filename) const {
374+
ull t = pd.optionssum ;
375+
if (inputbasename == UNKNOWNPUZZLE)
376+
t ^= pd.checksum ;
377+
if (t == 0)
378+
return ;
374379
filename.push_back('-') ;
375380
filename.push_back('o') ;
376-
ull t = pd.optionssum ;
377381
while (t) {
378382
int v = t % 36 ;
379383
t /= 36 ;
@@ -412,8 +416,7 @@ string prunetable::makefilename(const puzdef &pd) const {
412416
filename += to_string(bytes) ;
413417
if (suffix)
414418
filename += suffix ;
415-
if (pd.optionssum)
416-
addsumdat(pd, filename) ;
419+
addsumdat(pd, filename) ;
417420
filename += ".dat" ;
418421
return filename ;
419422
}

src/cpp/prunetable.h

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
const int CACHELINESIZE = 64 ;
2121
const int COMPSIGNATURE = 23 ; // start and end of data files
2222
const int UNCOMPSIGNATURE = 24 ; // start and end of data files
23+
#define UNKNOWNPUZZLE "unknownpuzzle"
2324
extern string inputbasename ;
2425
extern int nowrite ;
2526
extern int startprunedepth ;

src/cpp/twsearch.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void reseteverything() {
112112
looseiper = 0 ;
113113
basebits = 0 ;
114114
usehashenc = 0 ;
115-
inputbasename = "unknownpuzzle" ;
115+
inputbasename = UNKNOWNPUZZLE ;
116116
startprunedepth = 3 ;
117117
workerparams.clear() ;
118118
dllstates = 0 ;

0 commit comments

Comments
 (0)