Skip to content

Commit

Permalink
If permutation is missing in a Solved set, make a cnts array anyway.
Browse files Browse the repository at this point in the history
  • Loading branch information
rokicki committed Aug 10, 2023
1 parent 9fbde9a commit 6fdb71c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/cpp/readksolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,18 +190,23 @@ allocsetval readposition(puzdef &pz, char typ, istream *f, ull &checksum, bool z
for (int i=0; i<(int)pz.setdefs.size(); i++) {
uchar *p = r.dat + pz.setdefs[i].off ;
int n = pz.setdefs[i].size ;
vector<int> cnts ;
if (p[0] == 0) {
if (typ == 'S') {
for (int j=0; j<n; j++)
p[j] = pz.solved.dat[pz.setdefs[i].off+j] ;
} else {
for (int j=0; j<n; j++)
cnts.resize(n) ;
for (int j=0; j<n; j++) {
p[j] = j ; // identity perm
if (typ == 's')
cnts[j]++ ;
}
if (typ == 's') {
pz.setdefs[i].psum = n * (n - 1) / 2 ;
pz.setdefs[i].cnts = cnts ;
}
}
} else {
vector<int> cnts ;
int sum = 0 ;
for (int j=0; j<n; j++) {
int v = --p[j] ;
Expand Down

0 comments on commit 6fdb71c

Please sign in to comment.