# Jaap's Square-1 Solver with 'Ignore pieces' functionality

#### dougbenham

##### Member
To fix the prunning table issue, I simply suggest to compute table with the following flag :

1/ ignoring edge
2/ edge corect orientation
3/ edge corect permutation

1/ ignoring corners
2/ corners corect orientation
3/ corners corect permutation

The number of table to précompute isn't so important. I you have 2 "don't care permutation" edges, then use the 2 and if you have 2 "don't care orientation" edges, then use the 1 . The pruning table can be sub-optimal in these case, but allox an optimal solution to be found.

To allow automated computations, you should add a paramter xxx move more than optimal and xxx move max instead of press n or enter.

Well I understand the concept/theory behind the new tables. I'm just not sure how to programmatically implement it. Perhaps someone that is familiar with the program can help me out.

Here is a snippet of the pruning table calculator:
Code:
l=1;
do{
n=0;
if( turnMetric ){
for( i0=0; i0<NUMSHAPES; i0++ ){
for( i1=0; i1<70; i1++){
for( i2=0; i2<70; i2++){
if( table[i0][i1][i2]==l ){
for( m=0; m<3; m++){
j0=i0;j1=i1;j2=i2;
w=0;
do{
j2=sctc.tranTable[j0][j2][m];
j1=scte.tranTable[j0][j1][m];
j0=stt.tranTable[j0][m];
if( table[j0][j1][j2]==0 ){
table[j0][j1][j2]=l+1;
n++;
}
w++;
if(w>12){
exit(0);
}
}while(j0!=i0 || j1!=i1 || j2!=i2 );
}}}}}
}else{
for( i0=0; i0<NUMSHAPES; i0++ ){
for( i1=0; i1<70; i1++){
for( i2=0; i2<70; i2++){
if( table[i0][i1][i2]==l ){
// do twist
j0=stt.tranTable[i0][2];
j1=scte.tranTable[i0][i1][2];
j2=sctc.tranTable[i0][i2][2];
if( table[j0][j1][j2]==0 ){
n+=setAll(j0,j1,j2,l+1);
}
}
}}}
}
cout<<"     l="<<(int)l<<"  n="<<(int)n<<endl<<flush;
l++;
}while(n!=0);

##### Member
I don't know the program source code. But I know it use different tables when different metrics are used. So you should find somewhere a table selection/generation if it doesn't exist. It's where you should handle new cases.

Another solution is to generate the table « on the fly » adapted with the given case as JAcube does.

#### dougbenham

##### Member
So you should find somewhere a table selection/generation if it doesn't exist. It's where you should handle new cases.
Thats exactly what I posted above. That code is the code that generates the pruning table.

Another solution is to generate the table « on the fly » adapted with the given case as JAcube does.
This is a given. Of course it is going to need to be generated on the fly. I have looked at JACube source code and found the pruning table generation code, but I am still having difficulty understanding how it implements the 'ignore pieces' functionality.

#### 1973486

##### Member
This seems quite useful, mainly just the suboptimal bit though.

#### LucasSousa

##### Member
Thank you, man!

Can I start translating this to Java?

#### dougbenham

##### Member
Thank you, man!

Can I start translating this to Java?
Sure! Post up your results when you finish

#### N's-cvt

##### Member
I was trying to use the ignore function in the square-1 solver and it kept closing the program so can someone please take a look and see if there is something I am doing wrong:

D:\Games\sq1opt22>sq1optim.exe A2B3C1D45E6F7G8H -t-k-k-k----------
Jaap's Square-1 Optimizer v2.2 BETA http://www.jaapsch.net/ (modified by Doug Benham, [email protected])

Initializing...
5. Shape transition table..
4. Colouring 1 transition table..
3. Colouring 2 transition table..
2. Colouring 1 pruning table..
1. Colouring 2 pruning table..
0. Finished.

Flags: Turn Metric, Find Only First Solution
Position to solve: A2B3C1D45E6F7G8H
Searching depth 0..

"Has stopped working"

#### effperm

##### Member
"The link is deleted by the owner."
-pCloud

#### qwr

##### Member
please don't use these file upload sites. Put it on github or something. you can even release binaries there.

#### dougbenham

##### Member
please don't use these file upload sites. Put it on github or something. you can even release binaries there.

#### qwr

##### Member
these kinds of file uploading services never stick around as long as they should, as evidenced by

"The link is deleted by the owner."
-pCloud

plus they have annoying popups asking you to signup. since it's source code, you can put the code on github although idk what license it is released under.

#### dougbenham

##### Member
these kinds of file uploading services never stick around as long as they should, as evidenced by

plus they have annoying popups asking you to signup. since it's source code, you can put the code on github although idk what license it is released under.
That makes sense. However in this case it was my fault as I really did delete the link a while back by accident. I'll put it on github when I get a moment.

#### bostoncuber314

##### Member
Hi all. I'm new to the forum and very excited to join this community. I'm playing with Jaap and Doug's code, and my goal is to build an interactive Square-1 solver.

- Is there any Square-1 graphic library? I could find roofpig for the 3x3, but so far I haven't find anything similar for the Square-1. I really like cubedb.net visuals.

- Is the Square-1 solvable with only top or only bottom rotations, in general? Except for simple hand-built cases, the -onlytop and -onlybottom flags seem to loop forever.

Thanks all.