Bits naive_gen_bits() { Grid grid = naive_gen_grid(); Bits ret; ret.init(); backtrack_to_bits(grid, &ret); return ret; }
Bits Permutation::permute_bits(Bits* bits) { Bits ret; ret.init(); for(int i=0; i < 81; i++) { // p: spot in ret Spot p = spot_of_idx(i); // px: spot in bits Spot px = permute_spot(p); if(bits->has_value(px)) { ret.set_value(p, permute_val(bits->get_value(px))); } else { for(int k=1; k <=9; k++) { if(!bits->has_candidate(px, k)) { ret.remove_candidate(p, permute_val(k)); } } } } return ret; }