Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  Rubi2X
Language: C/C++
Code:
#include <iostream>
#include <ctime>
using namespace std;
struct matrice
{
     char matR[2][2];
     char matL[2][2];
     char matU[2][2];
     char matD[2][2];
     char matF[2][2];
     char matB[2][2];
};
matrice funzioneR(matrice x)
{
     char a,b,c,d,e,f;
     //ruoto R in senso orario
     a=x.matR[0][0];
     b=x.matR[0][1];
     x.matR[0][0]=x.matR[1][0];
     x.matR[1][0]=x.matR[1][1];
     x.matR[0][1]=a;
     x.matR[1][1]=b;
     //sposto le altre faccie
     c=x.matU[1][1];
     d=x.matU[0][1];
     e=x.matD[1][1];
     f=x.matD[0][1];
     x.matU[1][1]=x.matF[1][1];
     x.matU[0][1]=x.matF[0][1];
     x.matD[1][1]=x.matB[0][0];
     x.matD[0][1]=x.matB[1][0];
     x.matB[0][0]=c;
     x.matB[1][0]=d;
     x.matF[1][1]=e;
     x.matF[0][1]=f;
     //restituisco la struttura di matrici
     return x;
}
matrice funzioneRa(matrice x)
{
     char a,b,c,d,e,f;
     //ruoto R in senso antiorario
     a=x.matR[0][0];
     b=x.matR[0][1];
     x.matR[0][1]=x.matR[1][1];
     x.matR[1][1]=x.matR[1][0];
     x.matR[1][0]=a;
     x.matR[0][0]=b;
     //sposto le altre faccie
     c=x.matU[1][1];
     d=x.matU[0][1];
     e=x.matD[1][1];
     f=x.matD[0][1];
     x.matU[1][1]=x.matB[0][0];
     x.matU[0][1]=x.matB[1][0];
     x.matD[0][1]=x.matF[0][1];
     x.matD[1][1]=x.matF[1][1];
     x.matF[1][1]=c;
     x.matF[0][1]=d;
     x.matB[0][0]=e;
     x.matB[1][0]=f;
     //restituisco la struttura di matrici
     return x;
}
matrice funzioneL(matrice x)
{
     char a,b,c,d,e,f;
     //ruoto L in senso orario
     a=x.matL[0][0];
     b=x.matL[0][1];
     x.matL[0][0]=x.matL[1][0];
     x.matL[1][0]=x.matL[1][1];
     x.matL[0][1]=a;
     x.matL[1][1]=b;
     //sposto le altre faccie
     c=x.matU[0][0];
     d=x.matU[1][0];
     e=x.matD[0][0];
     f=x.matD[1][0];
     x.matU[0][0]=x.matB[1][1];
     x.matU[1][0]=x.matB[0][1];
     x.matD[1][0]=x.matF[1][0];
     x.matD[0][0]=x.matF[0][0];
     x.matF[0][0]=c;
     x.matF[1][0]=d;
     x.matB[1][1]=e;
     x.matB[0][1]=f;
     //restituisco la struttura di matrici
     return x;
}
matrice funzioneLa(matrice x)
{
     char a,b,c,d,e,f;
     //ruoto L in senso antiorario
     a=x.matL[0][0];
     b=x.matL[0][1];
     x.matL[0][1]=x.matL[1][1];
     x.matL[1][1]=x.matL[1][0];
     x.matL[1][0]=a;
     x.matL[0][0]=b;
     //sposto le altre faccie
     c=x.matU[0][0];
     d=x.matU[1][0];
     e=x.matD[0][0];
     f=x.matD[1][0];
     x.matU[0][0]=x.matF[0][0];
     x.matU[1][0]=x.matF[1][0];
     x.matD[0][0]=x.matB[1][1];
     x.matD[1][0]=x.matB[0][1];
     x.matB[1][1]=c;
     x.matB[0][1]=d;
     x.matF[0][0]=e;
     x.matF[1][0]=f;
     //restituisco la struttura di matrici
     return x;
}
matrice funzioneU(matrice x)
{
     char a,b,c,d,e,f;
     //ruoto U in senso orario
     a=x.matU[0][0];
     b=x.matU[0][1];
     x.matU[0][0]=x.matU[1][0];
     x.matU[1][0]=x.matU[1][1];
     x.matU[0][1]=a;
     x.matU[1][1]=b;
     //sposto le altre faccie
     c=x.matF[0][1];
     d=x.matF[0][0];
     e=x.matB[0][1];
     f=x.matB[0][0];
     x.matF[0][1]=x.matR[0][1];
     x.matF[0][0]=x.matR[0][0];
     x.matB[0][1]=x.matL[0][1];
     x.matB[0][0]=x.matL[0][0];
     x.matL[0][1]=c;
     x.matL[0][0]=d;
     x.matR[0][1]=e;
     x.matR[0][0]=f;
     //restituisco la struttura di matrici
     return x;
}
matrice funzioneUa(matrice x)
{
     char a,b,c,d,e,f;
     //ruoto U in senso antiorario
     a=x.matU[0][0];
     b=x.matU[0][1];
     x.matU[0][1]=x.matU[1][1];
     x.matU[1][1]=x.matU[1][0];
     x.matU[1][0]=a;
     x.matU[0][0]=b;
     //sposto le altre faccie
     c=x.matF[0][1];
     d=x.matF[0][0];
     e=x.matB[0][1];
     f=x.matB[0][0];
     x.matB[0][1]=x.matR[0][1];
     x.matB[0][0]=x.matR[0][0];
     x.matF[0][1]=x.matL[0][1];
     x.matF[0][0]=x.matL[0][0];
     x.matR[0][1]=c;
     x.matR[0][0]=d;
     x.matL[0][1]=e;
     x.matL[0][0]=f;
     //restituisco la struttura di matrici
     return x;
}
matrice funzioneD(matrice x)
{
     char a,b,c,d,e,f;
     //ruoto D in senso orario
     a=x.matD[0][0];
     b=x.matD[0][1];
     x.matD[0][0]=x.matD[1][0];
     x.matD[1][0]=x.matD[1][1];
     x.matD[0][1]=a;
     x.matD[1][1]=b;
     //sposto le altre faccie
     c=x.matF[1][0];
     d=x.matF[1][1];
     e=x.matB[1][0];
     f=x.matB[1][1];
     x.matF[1][0]=x.matL[1][0];
     x.matF[1][1]=x.matL[1][1];
     x.matB[1][0]=x.matR[1][0];
     x.matB[1][1]=x.matR[1][1];
     x.matR[1][0]=c;
     x.matR[1][1]=d;
     x.matL[1][0]=e;
     x.matL[1][1]=f;
     //restituisco la struttura di matrici
     return x;
}
matrice funzioneDa(matrice x)
{
     char a,b,c,d,e,f;
     //ruoto D in senso antiorario
     a=x.matD[0][0];
     b=x.matD[0][1];
     x.matD[0][1]=x.matD[1][1];
     x.matD[1][1]=x.matD[1][0];
     x.matD[1][0]=a;
     x.matD[0][0]=b;
     //sposto le altre faccie
     c=x.matF[1][0];
     d=x.matF[1][1];
     e=x.matB[1][0];
     f=x.matB[1][1];
     x.matF[1][0]=x.matR[1][0];
     x.matF[1][1]=x.matR[1][1];
     x.matB[1][0]=x.matL[1][0];
     x.matB[1][1]=x.matL[1][1];
     x.matL[1][0]=c;
     x.matL[1][1]=d;
     x.matR[1][0]=e;
     x.matR[1][1]=f;
     //restituisco la struttura di matrici
     return x;
}
matrice funzioneF(matrice x)
{
     char a,b,c,d,e,f;
     //ruoto F in senso orario
     a=x.matF[0][0];
     b=x.matF[0][1];
     x.matF[0][0]=x.matF[1][0];
     x.matF[1][0]=x.matF[1][1];
     x.matF[0][1]=a;
     x.matF[1][1]=b;
     //sposto le altre faccie
     c=x.matU[1][0];
     d=x.matU[1][1];
     e=x.matD[0][1];
     f=x.matD[0][0];
     x.matU[1][0]=x.matL[1][1];
     x.matU[1][1]=x.matL[0][1];
     x.matD[0][0]=x.matR[1][0];
     x.matD[0][1]=x.matR[0][0];
     x.matR[0][0]=c;
     x.matR[1][0]=d;
     x.matL[1][1]=e;
     x.matL[0][1]=f;
     //restituisco la struttura di matrici
     return x;
}
matrice funzioneFa(matrice x)
{
     char a,b,c,d,e,f;
     //ruoto F in senso antiorario
     a=x.matF[0][0];
     b=x.matF[0][1];
     x.matF[0][1]=x.matF[1][1];
     x.matF[1][1]=x.matF[1][0];
     x.matF[1][0]=a;
     x.matF[0][0]=b;
     //sposto le altre faccie
     c=x.matU[1][0];
     d=x.matU[1][1];
     e=x.matD[0][1];
     f=x.matD[0][0];
     x.matU[1][0]=x.matR[0][0];
     x.matU[1][1]=x.matR[1][0];
     x.matD[0][1]=x.matL[1][1];
     x.matD[0][0]=x.matL[0][1];
     x.matL[1][1]=c;
     x.matL[0][1]=d;
     x.matR[0][0]=e;
     x.matR[1][0]=f;
     //restituisco la struttura di matrici
     return x;
}
matrice funzioneB(matrice x)
{
     char a,b,c,d,e,f;
     //ruoto B in senso orario
     a=x.matB[0][0];
     b=x.matB[0][1];
     x.matB[0][0]=x.matB[1][0];
     x.matB[1][0]=x.matB[1][1];
     x.matB[0][1]=a;
     x.matB[1][1]=b;
     //sposto le altre faccie
     c=x.matU[0][1];
     d=x.matU[0][0];
     e=x.matD[1][0];
     f=x.matD[1][1];
     x.matU[0][0]=x.matR[0][1];
     x.matU[0][1]=x.matR[1][1];
     x.matD[1][1]=x.matL[1][0];
     x.matD[1][0]=x.matL[0][0];
     x.matL[0][0]=c;
     x.matL[1][0]=d;
     x.matR[1][1]=e;
     x.matR[0][1]=f;
     //restituisco la struttura di matrici
     return x;
}
matrice funzioneBa(matrice x)
{
     char a,b,c,d,e,f;
     //ruoto B in senso antiorario
     a=x.matB[0][0];
     b=x.matB[0][1];
     x.matB[0][1]=x.matB[1][1];
     x.matB[1][1]=x.matB[1][0];
     x.matB[1][0]=a;
     x.matB[0][0]=b;
     //sposto le altre faccie
     c=x.matU[0][1];
     d=x.matU[0][0];
     e=x.matD[1][0];
     f=x.matD[1][1];
     x.matU[0][1]=x.matL[0][0];
     x.matU[0][0]=x.matL[1][0];
     x.matD[1][0]=x.matR[1][1];
     x.matD[1][1]=x.matR[0][1];
     x.matR[1][1]=c;
     x.matR[0][1]=d;
     x.matL[0][0]=e;
     x.matL[1][0]=f;
     //restituisco la struttura di matrici
     return x;
}
matrice funzione_generale_a(matrice x,int a);
matrice funzione_generale_b(matrice x,int a,int b);
matrice funzione_generale_c(matrice x,int a,int b,int c);
matrice funzione_generale_d(matrice x,int a,int b,int c,int d);
matrice funzione_generale_e(matrice x,int a,int b,int c,int d,int e);
matrice funzione_generale_f(matrice x,int a,int b,int c,int d,int e,int f);
matrice funzione_generale_g(matrice x,int a,int b,int c,int d,int e,int f,int g);
matrice funzione_generale_h(matrice x,int a,int b,int c,int d,int e,int f,int g,int h);
matrice permutazione_a(matrice x);
matrice permutazione_aa(matrice x);
matrice permutazione_b(matrice x);
matrice permutazione_c(matrice x);
matrice permutazione_cc(matrice x);
matrice permutazione_d(matrice x);
matrice permutazione_e(matrice x);
matrice permutazione_ee(matrice x);
matrice permutazione_f(matrice x);
matrice allineamento_a(matrice x,int a);
matrice allineamento_b(matrice x,int a,int b);
matrice allineamento_c(matrice x,int a,int b,int c);
matrice allineamento_d(matrice x,int a,int b,int c,int d);
matrice allineamento_finale(matrice x,int a);
int main ()
{
     time_t one;time_t two;time_t range;int cont;
     //dichiaro la posizione iniziale dei colori
     matrice y;
     char ra,rb,rc,rd;
     char la,lb,lc,ld;
     char ua,ub,uc,ud;
     char da,db,dc,dd;
     char fa,fb,fc,fd;
     char ba,bb,bc,bd;
     cout<<"faccia R:";
     cin>>ra;cin>>rb;cin>>rc;cin>>rd;cout<<endl;
     cout<<"faccia L:";
     cin>>la;cin>>lb;cin>>lc;cin>>ld;cout<<endl;
     cout<<"faccia U:";
     cin>>ua;cin>>ub;cin>>uc;cin>>ud;cout<<endl;
     cout<<"faccia D:";
     cin>>da;cin>>db;cin>>dc;cin>>dd;cout<<endl;
     cout<<"faccia F:";
     cin>>fa;cin>>fb;cin>>fc;cin>>fd;cout<<endl;
     cout<<"faccia B:";
     cin>>ba;cin>>bb;cin>>bc;cin>>bd;cout<<endl;
     y.matR[0][0]=ra;y.matR[0][1]=rb;y.matR[1][0]=rc;y.matR[1][1]=rd;
     y.matL[0][0]=la;y.matL[0][1]=lb;y.matL[1][0]=lc;y.matL[1][1]=ld;
     y.matU[0][0]=ua;y.matU[0][1]=ub;y.matU[1][0]=uc;y.matU[1][1]=ud;
     y.matD[0][0]=da;y.matD[0][1]=db;y.matD[1][0]=dc;y.matD[1][1]=dd;
     y.matF[0][0]=fa;y.matF[0][1]=fb;y.matF[1][0]=fc;y.matF[1][1]=fd;
     y.matB[0][0]=ba;y.matB[0][1]=bb;y.matB[1][0]=bc;y.matB[1][1]=bd;
     system ("cls");
     //stampo la disposizione iniziale
     cout<<"configurazione iniziale del cubo:"<<endl;
     cout<<"    "<<y.matU[0][0]<<y.matU[0][1]<<endl;
     cout<<"    "<<y.matU[1][0]<<y.matU[1][1]<<endl;
     cout<<y.matB[0][0]<<y.matB[0][1]<<y.matL[0][0]<<y.matL[0][1]<<y.matF[0][0]<<y.matF[0][1]<<y.matR[0][0]<<y.matR[0][1]<<endl;
     cout<<y.matB[1][0]<<y.matB[1][1]<<y.matL[1][0]<<y.matL[1][1]<<y.matF[1][0]<<y.matF[1][1]<<y.matR[1][0]<<y.matR[1][1]<<endl;
     cout<<"    "<<y.matD[0][0]<<y.matD[0][1]<<endl;
     cout<<"    "<<y.matD[1][0]<<y.matD[1][1]<<endl;
     system ("pause");
     system ("cls");
     cout<<"risoluzione in corso..."<<endl;
     //copio la struttura del cubo in un'altra struttura
     matrice z=y;
     one=time(NULL);
     if(z.matR[0][0]==z.matR[0][1]&&z.matR[0][1]==z.matR[1][0]&&z.matR[1][0]==z.matR[1][1]&&z.matL[0][0]==z.matL[0][1]&&z.matL[0][1]==z.matL[1][0]&&z.matL[1][0]==z.matL[1][1]&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]&&z.matF[0][0]==z.matF[0][1]&&z.matF[0][1]==z.matF[1][0]&&z.matF[1][0]==z.matF[1][1]&&z.matB[0][0]==z.matB[0][1]&&z.matB[0][1]==z.matB[1][0]&&z.matB[1][0]==z.matB[1][1])
     {
          system ("cls");
          cout<<"cubo risolto"<<endl;
     }
     else
     {
          for(int size=1;size<9;size++)
          {
              if(size==1)
              {
                  for(int a=0;a<12;a++)
                  {
                       z=funzione_generale_a(z,a);
                       if(z.matR[0][0]==z.matR[0][1]&&z.matR[0][1]==z.matR[1][0]&&z.matR[1][0]==z.matR[1][1]&&z.matL[0][0]==z.matL[0][1]&&z.matL[0][1]==z.matL[1][0]&&z.matL[1][0]==z.matL[1][1]&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]&&z.matF[0][0]==z.matF[0][1]&&z.matF[0][1]==z.matF[1][0]&&z.matF[1][0]==z.matF[1][1]&&z.matB[0][0]==z.matB[0][1]&&z.matB[0][1]==z.matB[1][0]&&z.matB[1][0]==z.matB[1][1])
                       {
                            system ("cls");
                           cout<<"mosse da eseguire per risolvere il cubo:"<<endl;
                            switch (a)
                              {
                                 case(0):cout<<" R";break;
                                 case(1):cout<<" R'";break;
                                 case(2):cout<<" L";break;
                                 case(3):cout<<" L'";break;
                                 case(4):cout<<" U";break;
                                 case(5):cout<<" U'";break;
                                 case(6):cout<<" D";break;
                                 case(7):cout<<" D'";break;
                                 case(8):cout<<" F";break;
                                 case(9):cout<<" F'";break;
                                 case(10):cout<<" B";break;
                                 case(11):cout<<" B'";break;
                            };
                            a=12;size=9;
                            cout<<endl;
                       }
                       else{z=y;};
                  };
              }
              if(size==2)
              {
                  for(int a=0;a<12;a++)
                  {
                       for(int b=0;b<12;b++)
                       {
                            z=funzione_generale_b(z,a,b);
                            if(z.matR[0][0]==z.matR[0][1]&&z.matR[0][1]==z.matR[1][0]&&z.matR[1][0]==z.matR[1][1]&&z.matL[0][0]==z.matL[0][1]&&z.matL[0][1]==z.matL[1][0]&&z.matL[1][0]==z.matL[1][1]&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]&&z.matF[0][0]==z.matF[0][1]&&z.matF[0][1]==z.matF[1][0]&&z.matF[1][0]==z.matF[1][1]&&z.matB[0][0]==z.matB[0][1]&&z.matB[0][1]==z.matB[1][0]&&z.matB[1][0]==z.matB[1][1])
                            {
                                 system ("cls");
                                 cout<<"mosse da eseguire per risolvere il cubo:"<<endl;
                                 switch (b)
                                 {
                                      case(0):cout<<" R";break;
                                     case(1):cout<<" R'";break;
                                     case(2):cout<<" L";break;
                                     case(3):cout<<" L'";break;
                                     case(4):cout<<" U";break;
                                     case(5):cout<<" U'";break;
                                     case(6):cout<<" D";break;
                                     case(7):cout<<" D'";break;
                                     case(8):cout<<" F";break;
                                     case(9):cout<<" F'";break;
                                     case(10):cout<<" B";break;
                                     case(11):cout<<" B'";break;
                                 };
                                 b=12;
                                 switch (a)
                                 {
                                      case(0):cout<<" R";break;
                                     case(1):cout<<" R'";break;
                                     case(2):cout<<" L";break;
                                     case(3):cout<<" L'";break;
                                     case(4):cout<<" U";break;
                                     case(5):cout<<" U'";break;
                                     case(6):cout<<" D";break;
                                     case(7):cout<<" D'";break;
                                     case(8):cout<<" F";break;
                                     case(9):cout<<" F'";break;
                                     case(10):cout<<" B";break;
                                     case(11):cout<<" B'";break;
                                 };
                                 a=12;size=9;
                                 cout<<endl;
                            }
                            else{z=y;};
                       };
                  };
              }
              if(size==3)
              {
                  for(int a=0;a<12;a++)
                  {
                       for(int b=0;b<12;b++)
                       {
                            for(int c=0;c<12;c++)
                            {
                                 z=funzione_generale_c(z,a,b,c);
                                 if(z.matR[0][0]==z.matR[0][1]&&z.matR[0][1]==z.matR[1][0]&&z.matR[1][0]==z.matR[1][1]&&z.matL[0][0]==z.matL[0][1]&&z.matL[0][1]==z.matL[1][0]&&z.matL[1][0]==z.matL[1][1]&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]&&z.matF[0][0]==z.matF[0][1]&&z.matF[0][1]==z.matF[1][0]&&z.matF[1][0]==z.matF[1][1]&&z.matB[0][0]==z.matB[0][1]&&z.matB[0][1]==z.matB[1][0]&&z.matB[1][0]==z.matB[1][1])
                                 {
                                      system ("cls");
                                      cout<<"mosse da eseguire per risolvere il cubo:"<<endl;
                                      switch (c)
                                      {
                                           case(0):cout<<" R";break;
                                           case(1):cout<<" R'";break;
                                           case(2):cout<<" L";break;
                                           case(3):cout<<" L'";break;
                                           case(4):cout<<" U";break;
                                           case(5):cout<<" U'";break;
                                           case(6):cout<<" D";break;
                                           case(7):cout<<" D'";break;
                                           case(8):cout<<" F";break;
                                           case(9):cout<<" F'";break;
                                           case(10):cout<<" B";break;
                                           case(11):cout<<" B'";break;
                                      };
                                      c=12;
                                      switch (b)
                                      {
                                           case(0):cout<<" R";break;
                                           case(1):cout<<" R'";break;
                                           case(2):cout<<" L";break;
                                           case(3):cout<<" L'";break;
                                           case(4):cout<<" U";break;
                                           case(5):cout<<" U'";break;
                                           case(6):cout<<" D";break;
                                           case(7):cout<<" D'";break;
                                           case(8):cout<<" F";break;
                                           case(9):cout<<" F'";break;
                                           case(10):cout<<" B";break;
                                           case(11):cout<<" B'";break;
                                      };
                                      b=12;
                                      switch (a)
                                      {
                                           case(0):cout<<" R";break;
                                           case(1):cout<<" R'";break;
                                           case(2):cout<<" L";break;
                                           case(3):cout<<" L'";break;
                                           case(4):cout<<" U";break;
                                           case(5):cout<<" U'";break;
                                           case(6):cout<<" D";break;
                                           case(7):cout<<" D'";break;
                                           case(8):cout<<" F";break;
                                           case(9):cout<<" F'";break;
                                           case(10):cout<<" B";break;
                                           case(11):cout<<" B'";break;
                                      };
                                      a=12;size=9;
                                      cout<<endl;
                                 }
                                 else{z=y;};
                            };
                       };
                  };
              }
              if(size==4)
              {
                  for(int a=0;a<12;a++)
                  {
                       for(int b=0;b<12;b++)
                       {
                            for(int c=0;c<12;c++)
                            {
                                 for(int d=0;d<12;d++)
                                 {
                                      z=funzione_generale_d(z,a,b,c,d);
                                      if(z.matR[0][0]==z.matR[0][1]&&z.matR[0][1]==z.matR[1][0]&&z.matR[1][0]==z.matR[1][1]&&z.matL[0][0]==z.matL[0][1]&&z.matL[0][1]==z.matL[1][0]&&z.matL[1][0]==z.matL[1][1]&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]&&z.matF[0][0]==z.matF[0][1]&&z.matF[0][1]==z.matF[1][0]&&z.matF[1][0]==z.matF[1][1]&&z.matB[0][0]==z.matB[0][1]&&z.matB[0][1]==z.matB[1][0]&&z.matB[1][0]==z.matB[1][1])
                                      {
                                           system ("cls");
                                           cout<<"mosse da eseguire per risolvere il cubo:"<<endl;
                                           switch (d)
                                           {
                                                case(0):cout<<" R";break;
                                                case(1):cout<<" R'";break;
                                                case(2):cout<<" L";break;
                                                case(3):cout<<" L'";break;
                                                case(4):cout<<" U";break;
                                                case(5):cout<<" U'";break;
                                                case(6):cout<<" D";break;
                                                case(7):cout<<" D'";break;
                                                case(8):cout<<" F";break;
                                                case(9):cout<<" F'";break;
                                                case(10):cout<<" B";break;
                                                case(11):cout<<" B'";break;
                                           };
                                           d=12;
                                           switch (c)
                                           {
                                                case(0):cout<<" R";break;
                                                case(1):cout<<" R'";break;
                                                case(2):cout<<" L";break;
                                                case(3):cout<<" L'";break;
                                                case(4):cout<<" U";break;
                                                case(5):cout<<" U'";break;
                                                case(6):cout<<" D";break;
                                                case(7):cout<<" D'";break;
                                                case(8):cout<<" F";break;
                                                case(9):cout<<" F'";break;
                                                case(10):cout<<" B";break;
                                                case(11):cout<<" B'";break;
                                           };
                                          c=12;
                                          switch (b)
                                          {
                                                case(0):cout<<" R";break;
                                                case(1):cout<<" R'";break;
                                                case(2):cout<<" L";break;
                                                case(3):cout<<" L'";break;
                                                case(4):cout<<" U";break;
                                                case(5):cout<<" U'";break;
                                                case(6):cout<<" D";break;
                                                case(7):cout<<" D'";break;
                                                case(8):cout<<" F";break;
                                                case(9):cout<<" F'";break;
                                                case(10):cout<<" B";break;
                                                case(11):cout<<" B'";break;
                                           };
                                           b=12;
                                           switch (a)
                                           {
                                                case(0):cout<<" R";break;
                                                case(1):cout<<" R'";break;
                                                case(2):cout<<" L";break;
                                                case(3):cout<<" L'";break;
                                                case(4):cout<<" U";break;
                                                case(5):cout<<" U'";break;
                                                case(6):cout<<" D";break;
                                                case(7):cout<<" D'";break;
                                                case(8):cout<<" F";break;
                                                case(9):cout<<" F'";break;
                                                case(10):cout<<" B";break;
                                                case(11):cout<<" B'";break;
                                           };
                                           a=12;size=9;
                                           cout<<endl;
                                      }
                                      else{z=y;};
                                 };
                            };
                       };
                  };
              }
              if(size==5)
              {
                  for(int a=0;a<12;a++)
                  {
                       for(int b=0;b<12;b++)
                       {
                            for(int c=0;c<12;c++)
                            {
                                 for(int d=0;d<12;d++)
                                 {
                                      for(int e=0;e<12;e++)
                                      {
                                           z=funzione_generale_e(z,a,b,c,d,e);
                                           if(z.matR[0][0]==z.matR[0][1]&&z.matR[0][1]==z.matR[1][0]&&z.matR[1][0]==z.matR[1][1]&&z.matL[0][0]==z.matL[0][1]&&z.matL[0][1]==z.matL[1][0]&&z.matL[1][0]==z.matL[1][1]&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]&&z.matF[0][0]==z.matF[0][1]&&z.matF[0][1]==z.matF[1][0]&&z.matF[1][0]==z.matF[1][1]&&z.matB[0][0]==z.matB[0][1]&&z.matB[0][1]==z.matB[1][0]&&z.matB[1][0]==z.matB[1][1])
                                             {
                                                system ("cls");
                                                cout<<"mosse da eseguire per risolvere il cubo:"<<endl;
                                                switch (e)
                                                {
                                                     case(0):cout<<" R";break;
                                                     case(1):cout<<" R'";break;
                                                     case(2):cout<<" L";break;
                                                     case(3):cout<<" L'";break;
                                                     case(4):cout<<" U";break;
                                                     case(5):cout<<" U'";break;
                                                     case(6):cout<<" D";break;
                                                     case(7):cout<<" D'";break;
                                                     case(8):cout<<" F";break;
                                                     case(9):cout<<" F'";break;
                                                     case(10):cout<<" B";break;
                                                     case(11):cout<<" B'";break;
                                                };
                                                e=12;
                                                switch (d)
                                                {
                                                     case(0):cout<<" R";break;
                                                     case(1):cout<<" R'";break;
                                                     case(2):cout<<" L";break;
                                                     case(3):cout<<" L'";break;
                                                     case(4):cout<<" U";break;
                                                     case(5):cout<<" U'";break;
                                                     case(6):cout<<" D";break;
                                                     case(7):cout<<" D'";break;
                                                     case(8):cout<<" F";break;
                                                     case(9):cout<<" F'";break;
                                                     case(10):cout<<" B";break;
                                                     case(11):cout<<" B'";break;
                                                };
                                                d=12;
                                                switch (c)
                                                {
                                                     case(0):cout<<" R";break;
                                                     case(1):cout<<" R'";break;
                                                     case(2):cout<<" L";break;
                                                     case(3):cout<<" L'";break;
                                                     case(4):cout<<" U";break;
                                                     case(5):cout<<" U'";break;
                                                     case(6):cout<<" D";break;
                                                     case(7):cout<<" D'";break;
                                                     case(8):cout<<" F";break;
                                                     case(9):cout<<" F'";break;
                                                     case(10):cout<<" B";break;
                                                     case(11):cout<<" B'";break;
                                                };
                                                c=12;
                                                switch (b)
                                                {
                                                     case(0):cout<<" R";break;
                                                     case(1):cout<<" R'";break;
                                                     case(2):cout<<" L";break;
                                                     case(3):cout<<" L'";break;
                                                     case(4):cout<<" U";break;
                                                     case(5):cout<<" U'";break;
                                                     case(6):cout<<" D";break;
                                                     case(7):cout<<" D'";break;
                                                     case(8):cout<<" F";break;
                                                     case(9):cout<<" F'";break;
                                                     case(10):cout<<" B";break;
                                                     case(11):cout<<" B'";break;
                                                };
                                                b=12;
                                                switch (a)
                                                {
                                                     case(0):cout<<" R";break;
                                                     case(1):cout<<" R'";break;
                                                     case(2):cout<<" L";break;
                                                     case(3):cout<<" L'";break;
                                                     case(4):cout<<" U";break;
                                                     case(5):cout<<" U'";break;
                                                     case(6):cout<<" D";break;
                                                     case(7):cout<<" D'";break;
                                                     case(8):cout<<" F";break;
                                                     case(9):cout<<" F'";break;
                                                     case(10):cout<<" B";break;
                                                     case(11):cout<<" B'";break;
                                                };
                                                a=12;size=9;
                                                cout<<endl;
                                           }
                                           else{z=y;};
                                      };
                                 };
                            };
                       };
                  };
              }
              if(size==6)
              {
                  for(int a=0;a<12;a++)
                  {
                       for(int b=0;b<12;b++)
                       {
                            for(int c=0;c<12;c++)
                            {
                                 for(int d=0;d<12;d++)
                                {
                                      for(int e=0;e<12;e++)
                                      {
                                           for(int f=0;f<12;f++)
                                           {
                                                z=funzione_generale_f(z,a,b,c,d,e,f);
                                                if(z.matR[0][0]==z.matR[0][1]&&z.matR[0][1]==z.matR[1][0]&&z.matR[1][0]==z.matR[1][1]&&z.matL[0][0]==z.matL[0][1]&&z.matL[0][1]==z.matL[1][0]&&z.matL[1][0]==z.matL[1][1]&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]&&z.matF[0][0]==z.matF[0][1]&&z.matF[0][1]==z.matF[1][0]&&z.matF[1][0]==z.matF[1][1]&&z.matB[0][0]==z.matB[0][1]&&z.matB[0][1]==z.matB[1][0]&&z.matB[1][0]==z.matB[1][1])
                                                {
                                                     system ("cls");
                                                     cout<<"mosse da eseguire per risolvere il cubo:"<<endl;
                                                     switch (f)
                                                     {
                                                          case(0):cout<<" R";break;
                                                          case(1):cout<<" R'";break;
                                                          case(2):cout<<" L";break;
                                                          case(3):cout<<" L'";break;
                                                          case(4):cout<<" U";break;
                                                          case(5):cout<<" U'";break;
                                                          case(6):cout<<" D";break;
                                                          case(7):cout<<" D'";break;
                                                          case(8):cout<<" F";break;
                                                          case(9):cout<<" F'";break;
                                                          case(10):cout<<" B";break;
                                                          case(11):cout<<" B'";break;
                                                     };
                                                     f=12;
                                                     switch (e)
                                                     {
                                                          case(0):cout<<" R";break;
                                                          case(1):cout<<" R'";break;
                                                          case(2):cout<<" L";break;
                                                          case(3):cout<<" L'";break;
                                                          case(4):cout<<" U";break;
                                                          case(5):cout<<" U'";break;
                                                          case(6):cout<<" D";break;
                                                          case(7):cout<<" D'";break;
                                                          case(8):cout<<" F";break;
                                                          case(9):cout<<" F'";break;
                                                          case(10):cout<<" B";break;
                                                          case(11):cout<<" B'";break;
                                                     };
                                                     e=12;
                                                     switch (d)
                                                     {
                                                          case(0):cout<<" R";break;
                                                          case(1):cout<<" R'";break;
                                                          case(2):cout<<" L";break;
                                                          case(3):cout<<" L'";break;
                                                          case(4):cout<<" U";break;
                                                          case(5):cout<<" U'";break;
                                                          case(6):cout<<" D";break;
                                                          case(7):cout<<" D'";break;
                                                          case(8):cout<<" F";break;
                                                          case(9):cout<<" F'";break;
                                                          case(10):cout<<" B";break;
                                                          case(11):cout<<" B'";break;
                                                     };
                                                     d=12;
                                                       switch (c)
                                                     {
                                                          case(0):cout<<" R";break;
                                                          case(1):cout<<" R'";break;
                                                          case(2):cout<<" L";break;
                                                          case(3):cout<<" L'";break;
                                                          case(4):cout<<" U";break;
                                                          case(5):cout<<" U'";break;
                                                          case(6):cout<<" D";break;
                                                          case(7):cout<<" D'";break;
                                                          case(8):cout<<" F";break;
                                                          case(9):cout<<" F'";break;
                                                          case(10):cout<<" B";break;
                                                          case(11):cout<<" B'";break;
                                                     };
                                                     c=12;
                                                     switch (b)
                                                     {
                                                          case(0):cout<<" R";break;
                                                          case(1):cout<<" R'";break;
                                                          case(2):cout<<" L";break;
                                                          case(3):cout<<" L'";break;
                                                          case(4):cout<<" U";break;
                                                          case(5):cout<<" U'";break;
                                                          case(6):cout<<" D";break;
                                                          case(7):cout<<" D'";break;
                                                          case(8):cout<<" F";break;
                                                          case(9):cout<<" F'";break;
                                                          case(10):cout<<" B";break;
                                                          case(11):cout<<" B'";break;
                                                     };
                                                     b=12;
                                                     switch (a)
                                                     {
                                                          case(0):cout<<" R";break;
                                                          case(1):cout<<" R'";break;
                                                          case(2):cout<<" L";break;
                                                          case(3):cout<<" L'";break;
                                                          case(4):cout<<" U";break;
                                                          case(5):cout<<" U'";break;
                                                          case(6):cout<<" D";break;
                                                          case(7):cout<<" D'";break;
                                                          case(8):cout<<" F";break;
                                                          case(9):cout<<" F'";break;
                                                          case(10):cout<<" B";break;
                                                          case(11):cout<<" B'";break;
                                                     };
                                                     a=12;size=9;
                                                     cout<<endl;
                                                }
                                                else{z=y;};
                                           };
                                      };
                                 };
                            };
                       };
                  };
              }
              if(size==7)
              {
                  for(int a=0;a<12;a++)
                  {
                       for(int b=0;b<12;b++)
                       {
                            for(int c=0;c<12;c++)
                            {
                                 for(int d=0;d<12;d++)
                                 {
                                     for(int e=0;e<12;e++)
                                      {
                                           for(int f=0;f<12;f++)
                                           {
                                                for(int g=0;g<12;g++)
                                                {
                                                     z=funzione_generale_g(z,a,b,c,d,e,f,g);
                                                     if(z.matR[0][0]==z.matR[0][1]&&z.matR[0][1]==z.matR[1][0]&&z.matR[1][0]==z.matR[1][1]&&z.matL[0][0]==z.matL[0][1]&&z.matL[0][1]==z.matL[1][0]&&z.matL[1][0]==z.matL[1][1]&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]&&z.matF[0][0]==z.matF[0][1]&&z.matF[0][1]==z.matF[1][0]&&z.matF[1][0]==z.matF[1][1]&&z.matB[0][0]==z.matB[0][1]&&z.matB[0][1]==z.matB[1][0]&&z.matB[1][0]==z.matB[1][1])
                                                     {
                                                          system ("cls");
                                                          cout<<"mosse da eseguire per risolvere il cubo:"<<endl;
                                                          switch (g)
                                                          {
                                                               case(0):cout<<" R";break;
                                                               case(1):cout<<" R'";break;
                                                               case(2):cout<<" L";break;
                                                               case(3):cout<<" L'";break;
                                                               case(4):cout<<" U";break;
                                                               case(5):cout<<" U'";break;
                                                               case(6):cout<<" D";break;
                                                               case(7):cout<<" D'";break;
                                                               case(8):cout<<" F";break;
                                                               case(9):cout<<" F'";break;
                                                               case(10):cout<<" B";break;
                                                               case(11):cout<<" B'";break;
                                                          };
                                                          g=12;
                                                          switch (f)
                                                          {
                                                               case(0):cout<<" R";break;
                                                               case(1):cout<<" R'";break;
                                                               case(2):cout<<" L";break;
                                                               case(3):cout<<" L'";break;
                                                               case(4):cout<<" U";break;
                                                               case(5):cout<<" U'";break;
                                                               case(6):cout<<" D";break;
                                                               case(7):cout<<" D'";break;
                                                               case(8):cout<<" F";break;
                                                               case(9):cout<<" F'";break;
                                                               case(10):cout<<" B";break;
                                                               case(11):cout<<" B'";break;
                                                          };
                                                          f=12;
                                                          switch (e)
                                                          {
                                                               case(0):cout<<" R";break;
                                                               case(1):cout<<" R'";break;
                                                               case(2):cout<<" L";break;
                                                               case(3):cout<<" L'";break;
                                                               case(4):cout<<" U";break;
                                                               case(5):cout<<" U'";break;
                                                               case(6):cout<<" D";break;
                                                               case(7):cout<<" D'";break;
                                                               case(8):cout<<" F";break;
                                                               case(9):cout<<" F'";break;
                                                               case(10):cout<<" B";break;
                                                               case(11):cout<<" B'";break;
                                                          };
                                                          e=12;
                                                          switch (d)
                                                          {
                                                               case(0):cout<<" R";break;
                                                               case(1):cout<<" R'";break;
                                                               case(2):cout<<" L";break;
                                                               case(3):cout<<" L'";break;
                                                               case(4):cout<<" U";break;
                                                               case(5):cout<<" U'";break;
                                                               case(6):cout<<" D";break;
                                                               case(7):cout<<" D'";break;
                                                               case(8):cout<<" F";break;
                                                               case(9):cout<<" F'";break;
                                                               case(10):cout<<" B";break;
                                                               case(11):cout<<" B'";break;
                                                          };
                                                          d=12;
                                                          switch (c)
                                                          {
                                                               case(0):cout<<" R";break;
                                                               case(1):cout<<" R'";break;
                                                               case(2):cout<<" L";break;
                                                               case(3):cout<<" L'";break;
                                                               case(4):cout<<" U";break;
                                                               case(5):cout<<" U'";break;
                                                               case(6):cout<<" D";break;
                                                               case(7):cout<<" D'";break;
                                                               case(8):cout<<" F";break;
                                                               case(9):cout<<" F'";break;
                                                               case(10):cout<<" B";break;
                                                               case(11):cout<<" B'";break;
                                                          };
                                                          c=12;
                                                          switch (b)
                                                          {
                                                               case(0):cout<<" R";break;
                                                               case(1):cout<<" R'";break;
                                                               case(2):cout<<" L";break;
                                                               case(3):cout<<" L'";break;
                                                               case(4):cout<<" U";break;
                                                               case(5):cout<<" U'";break;
                                                               case(6):cout<<" D";break;
                                                               case(7):cout<<" D'";break;
                                                               case(8):cout<<" F";break;
                                                               case(9):cout<<" F'";break;
                                                               case(10):cout<<" B";break;
                                                               case(11):cout<<" B'";break;
                                                          };
                                                          b=12;
                                                          switch (a)
                                                          {
                                                               case(0):cout<<" R";break;
                                                               case(1):cout<<" R'";break;
                                                               case(2):cout<<" L";break;
                                                               case(3):cout<<" L'";break;
                                                               case(4):cout<<" U";break;
                                                               case(5):cout<<" U'";break;
                                                               case(6):cout<<" D";break;
                                                               case(7):cout<<" D'";break;
                                                               case(8):cout<<" F";break;
                                                               case(9):cout<<" F'";break;
                                                               case(10):cout<<" B";break;
                                                               case(11):cout<<" B'";break;
                                                          };
                                                          a=12;size=9;
                                                          cout<<endl;
                                                     }
                                                     else{z=y;};
                                                };
                                           };
                                      };
                                 };
                            };
                       };
                  };
              }
         };
    }
    if(!(z.matR[0][0]==z.matR[0][1]&&z.matR[0][1]==z.matR[1][0]&&z.matR[1][0]==z.matR[1][1]&&z.matL[0][0]==z.matL[0][1]&&z.matL[0][1]==z.matL[1][0]&&z.matL[1][0]==z.matL[1][1]&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]&&z.matF[0][0]==z.matF[0][1]&&z.matF[0][1]==z.matF[1][0]&&z.matF[1][0]==z.matF[1][1]&&z.matB[0][0]==z.matB[0][1]&&z.matB[0][1]==z.matB[1][0]&&z.matB[1][0]==z.matB[1][1]))
    {
         for(int size=1;size<9;size++)
          {
              if(size==1)
              {
                  for(int a=0;a<12;a++)
                  {
                       z=funzione_generale_a(z,a);
                       if(z.matU[0][0]=='y'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='w'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='w'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='y'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='g'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='b'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='b'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='g'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='r'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='o'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='o'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='r'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1])
                       {
                            system ("cls");
                           cout<<"mosse da eseguire per risolvere il cubo:"<<endl;
                           cont=a;
                            switch (a)
                              {
                                 case(0):cout<<" R";break;
                                 case(1):cout<<" R'";break;
                                 case(2):cout<<" L";break;
                                 case(3):cout<<" L'";break;
                                 case(4):cout<<" U";break;
                                 case(5):cout<<" U'";break;
                                 case(6):cout<<" D";break;
                                 case(7):cout<<" D'";break;
                                 case(8):cout<<" F";break;
                                 case(9):cout<<" F'";break;
                                 case(10):cout<<" B";break;
                                 case(11):cout<<" B'";break;
                            };
                            a=12;size=9;
                       }
                       else{z=y;};
                  };
              }
              if(size==2)
              {
                  for(int a=0;a<12;a++)
                  {
                       for(int b=0;b<12;b++)
                       {
                            z=funzione_generale_b(z,a,b);
                            if(z.matU[0][0]=='y'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='w'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='w'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='y'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='g'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='b'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='b'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='g'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='r'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='o'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='o'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='r'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1])
                            {
                                 system ("cls");
                                 cout<<"mosse da eseguire per risolvere il cubo:"<<endl;
                                 switch (b)
                                 {
                                      case(0):cout<<" R";break;
                                     case(1):cout<<" R'";break;
                                     case(2):cout<<" L";break;
                                     case(3):cout<<" L'";break;
                                     case(4):cout<<" U";break;
                                     case(5):cout<<" U'";break;
                                     case(6):cout<<" D";break;
                                     case(7):cout<<" D'";break;
                                     case(8):cout<<" F";break;
                                     case(9):cout<<" F'";break;
                                     case(10):cout<<" B";break;
                                     case(11):cout<<" B'";break;
                                 };
                                 b=12;
                                 cont=a;
                                 switch (a)
                                 {
                                      case(0):cout<<" R";break;
                                     case(1):cout<<" R'";break;
                                     case(2):cout<<" L";break;
                                     case(3):cout<<" L'";break;
                                     case(4):cout<<" U";break;
                                     case(5):cout<<" U'";break;
                                     case(6):cout<<" D";break;
                                     case(7):cout<<" D'";break;
                                     case(8):cout<<" F";break;
                                     case(9):cout<<" F'";break;
                                     case(10):cout<<" B";break;
                                     case(11):cout<<" B'";break;
                                 };
                                 a=12;size=9;
                            }
                            else{z=y;};
                       };
                  };
              }
              if(size==3)
              {
                  for(int a=0;a<12;a++)
                  {
                       for(int b=0;b<12;b++)
                       {
                            for(int c=0;c<12;c++)
                            {
                                 z=funzione_generale_c(z,a,b,c);
                                 if(z.matU[0][0]=='y'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='w'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='w'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='y'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='g'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='b'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='b'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='g'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='r'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='o'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='o'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='r'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1])
                                 {
                                      system ("cls");
                                      cout<<"mosse da eseguire per risolvere il cubo:"<<endl;
                                      switch (c)
                                      {
                                           case(0):cout<<" R";break;
                                           case(1):cout<<" R'";break;
                                           case(2):cout<<" L";break;
                                           case(3):cout<<" L'";break;
                                           case(4):cout<<" U";break;
                                           case(5):cout<<" U'";break;
                                           case(6):cout<<" D";break;
                                           case(7):cout<<" D'";break;
                                           case(8):cout<<" F";break;
                                           case(9):cout<<" F'";break;
                                           case(10):cout<<" B";break;
                                           case(11):cout<<" B'";break;
                                      };
                                      c=12;
                                      switch (b)
                                      {
                                           case(0):cout<<" R";break;
                                           case(1):cout<<" R'";break;
                                           case(2):cout<<" L";break;
                                           case(3):cout<<" L'";break;
                                           case(4):cout<<" U";break;
                                           case(5):cout<<" U'";break;
                                           case(6):cout<<" D";break;
                                           case(7):cout<<" D'";break;
                                           case(8):cout<<" F";break;
                                           case(9):cout<<" F'";break;
                                           case(10):cout<<" B";break;
                                           case(11):cout<<" B'";break;
                                      };
                                      b=12;
                                      cont=a;
                                      switch (a)
                                      {
                                           case(0):cout<<" R";break;
                                           case(1):cout<<" R'";break;
                                           case(2):cout<<" L";break;
                                           case(3):cout<<" L'";break;
                                           case(4):cout<<" U";break;
                                           case(5):cout<<" U'";break;
                                           case(6):cout<<" D";break;
                                           case(7):cout<<" D'";break;
                                           case(8):cout<<" F";break;
                                           case(9):cout<<" F'";break;
                                           case(10):cout<<" B";break;
                                           case(11):cout<<" B'";break;
                                      };
                                      a=12;size=9;
                                 }
                                 else{z=y;};
                            };
                       };
                  };
              }
              if(size==4)
              {
                  for(int a=0;a<12;a++)
                  {
                       for(int b=0;b<12;b++)
                       {
                            for(int c=0;c<12;c++)
                            {
                                 for(int d=0;d<12;d++)
                                 {
                                      z=funzione_generale_d(z,a,b,c,d);
                                      if(z.matU[0][0]=='y'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='w'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='w'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='y'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='g'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='b'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='b'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='g'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='r'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='o'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='o'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='r'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1])
                                      {
                                           system ("cls");
                                           cout<<"mosse da eseguire per risolvere il cubo:"<<endl;
                                           switch (d)
                                           {
                                                case(0):cout<<" R";break;
                                                case(1):cout<<" R'";break;
                                                case(2):cout<<" L";break;
                                                case(3):cout<<" L'";break;
                                                case(4):cout<<" U";break;
                                                case(5):cout<<" U'";break;
                                                case(6):cout<<" D";break;
                                                case(7):cout<<" D'";break;
                                                case(8):cout<<" F";break;
                                                case(9):cout<<" F'";break;
                                                case(10):cout<<" B";break;
                                                case(11):cout<<" B'";break;
                                           };
                                           d=12;
                                           switch (c)
                                           {
                                                case(0):cout<<" R";break;
                                                case(1):cout<<" R'";break;
                                                case(2):cout<<" L";break;
                                                case(3):cout<<" L'";break;
                                                case(4):cout<<" U";break;
                                                case(5):cout<<" U'";break;
                                                case(6):cout<<" D";break;
                                                case(7):cout<<" D'";break;
                                                case(8):cout<<" F";break;
                                                case(9):cout<<" F'";break;
                                                case(10):cout<<" B";break;
                                                case(11):cout<<" B'";break;
                                           };
                                          c=12;
                                          switch (b)
                                          {
                                                case(0):cout<<" R";break;
                                                case(1):cout<<" R'";break;
                                                case(2):cout<<" L";break;
                                                case(3):cout<<" L'";break;
                                                case(4):cout<<" U";break;
                                                case(5):cout<<" U'";break;
                                                case(6):cout<<" D";break;
                                                case(7):cout<<" D'";break;
                                                case(8):cout<<" F";break;
                                                case(9):cout<<" F'";break;
                                                case(10):cout<<" B";break;
                                                case(11):cout<<" B'";break;
                                           };
                                           b=12;
                                           cont=a;
                                           switch (a)
                                           {
                                                case(0):cout<<" R";break;
                                                case(1):cout<<" R'";break;
                                                case(2):cout<<" L";break;
                                                case(3):cout<<" L'";break;
                                                case(4):cout<<" U";break;
                                                case(5):cout<<" U'";break;
                                                case(6):cout<<" D";break;
                                                case(7):cout<<" D'";break;
                                                case(8):cout<<" F";break;
                                                case(9):cout<<" F'";break;
                                                case(10):cout<<" B";break;
                                                case(11):cout<<" B'";break;
                                           };
                                           a=12;size=9;
                                      }
                                      else{z=y;};
                                 };
                            };
                       };
                  };
              }
              if(size==5)
              {
                  for(int a=0;a<12;a++)
                  {
                       for(int b=0;b<12;b++)
                       {
                            for(int c=0;c<12;c++)
                            {
                                 for(int d=0;d<12;d++)
                                 {
                                      for(int e=0;e<12;e++)
                                      {
                                           z=funzione_generale_e(z,a,b,c,d,e);
                                           if(z.matU[0][0]=='y'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='w'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='w'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='y'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='g'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='b'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='b'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='g'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='r'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='o'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1]||z.matU[0][0]=='o'&&z.matU[0][0]==z.matU[0][1]&&z.matU[0][1]==z.matU[1][0]&&z.matU[1][0]==z.matU[1][1]&&z.matD[0][0]=='r'&&z.matD[0][0]==z.matD[0][1]&&z.matD[0][1]==z.matD[1][0]&&z.matD[1][0]==z.matD[1][1])
                                             {
                                                system ("cls");
                                                cout<<"mosse da eseguire per risolvere il cubo:"<<endl;
                                                switch (e)
                                                {
                                                     case(0):cout<<" R";break;
                                                     case(1):cout<<" R'";break;
                                                     case(2):cout<<" L";break;
                                                     case(3):cout<<" L'";break;
                                                     case(4):cout<<" U";break;
                                                     case(5):cout<<" U'";break;
                                                     case(6):cout<<" D";break;
                                                     case(7):cout<<" D'";break;
                                                     case(8):cout<<" F";break;
                                                     case(9):cout<<" F'";break;
                                                     case(10):cout<<" B";break;
                                                     case(11):cout<<" B'";break;
                                                };
                                                e=12;
                                                switch (d)
                                                {
                                                     case(0):cout<<" R";break;
                                                     case(1):cout<<" R'";break;
                                                     case(2):cout<<" L";break;
                                                     case(3):cout<<" L'";break;
                                                     case(4):cout<<" U";break;
                                                     case(5):cout<<" U'";break;
                                                     case(6):cout<<" D";break;
                                                     case(7):cout<<" D'";break;
                                                     case(8):cout<<" F";break;
                                                     case(9):cout<<" F'";break;
                                                     case(10):cout<<" B";break;
                                                     case(11):cout<<" B'";break;
                                                };
                                                d=12;
                                                switch (c)
                                                {
                                                     case(0):cout<<" R";break;
                                                     case(1):cout<<" R'";break;
                                                     case(2):cout<<" L";break;
                                                     case(3):cout<<" L'";break;
                                                     case(4):cout<<" U";break;
                                                     case(5):cout<<" U'";break;
                                                     case(6):cout<<" D";break;
                                                     case(7):cout<<" D'";break;
                                                     case(8):cout<<" F";break;
                                                     case(9):cout<<" F'";break;
                                                     case(10):cout<<" B";break;
                                                     case(11):cout<<" B'";break;
                                                };
                                                c=12;
                                                switch (b)
                                                {
                                                     case(0):cout<<" R";break;
                                                     case(1):cout<<" R'";break;
                                                     case(2):cout<<" L";break;
                                                     case(3):cout<<" L'";break;
                                                     case(4):cout<<" U";break;
                                                     case(5):cout<<" U'";break;
                                                     case(6):cout<<" D";break;
                                                     case(7):cout<<" D'";break;
                                                     case(8):cout<<" F";break;
                                                     case(9):cout<<" F'";break;
                                                     case(10):cout<<" B";break;
                                                     case(11):cout<<" B'";break;
                                                };
                                                b=12;
                                                cont=a;
                                                switch (a)
                                                {
                                                     case(0):cout<<" R";break;
                                                     case(1):cout<<" R'";break;
                                                     case(2):cout<<" L";break;
                                                     case(3):cout<<" L'";break;
                                                     case(4):cout<<" U";break;
                                                     case(5):cout<&
Comments: