魔方CFOP算法java实现

  1. import lejos.nxt.*;  
  2. import lejos.nxt.comm.*;  
  3.   
  4. /** 
  5.  * Solve Rubik's Cube By CFOP 
  6.  * @author ChenWu http://www.diy-robots.com 
  7.  * @see CFOP 
  8.  */  
  9. public class CFOP  
  10. {  
  11.     static String SideColors[] = {  
  12.         "orgorwwoo",  
  13.         "oyggbobrg",  
  14.         "yyrgowwbw",  
  15.         "yrybgybbo",  
  16.         "gwwyybror",  
  17.         "bgrwwrbgy"  
  18.     };  
  19.   
  20.     public static void main (String[] aArg) throws Exception  
  21.     {  
  22.         Steps.Clear();  
  23.         if(Rubik.ImportColor(SideColors)=="")  
  24.         {  
  25.             TopCross();  
  26.             TopCorner();  
  27.             SecondLayer();  
  28.             BottomCross();  
  29.             BottomCorner();  
  30.             ThirdLayerCorner();  
  31.             ThirdLayerCornerSnap();  
  32.             ThirdLayerBorderSnap();  
  33.         }  
  34.         //Now the steps are saved in Steps Object  
  35.         for(int i=0;i<Steps.Count;i++)  
  36.         {  
  37.             Steps.Index=i;  
  38.             //int c = Steps.Color(); //Color  
  39.             //bool ColockWise = Steps.ClockWise(); //Rotate direction  
  40.             //int Quarter = Steps.Quarter(); //Number of quarter be rotated  
  41.         }  
  42.     }  
  43.       
  44.     public static void TopCross() throws Exception  
  45.     {  
  46.         int GetPos=0;  
  47.         int[] c=new int[5];  
  48.         int CurrentStep=Steps.Count;  
  49.           
  50.         c[0]=Rubik.Sides[0][1][1];  
  51.         c[1]=Rubik.Sides[1][1][1];  
  52.         c[2]=Rubik.Sides[5][1][1];  
  53.         c[3]=Rubik.Sides[3][1][1];  
  54.         c[4]=Rubik.Sides[4][1][1];  
  55.         for(int i=1;i<5;i++)  
  56.         {  
  57.             CurrentStep=Steps.Count;  
  58.             Rubik.ChangeViewToColor(c[0]);  
  59.             Rubik.ChangeViewFromTopByNextColor(c[i]);  
  60.             GetPos=Rubik.FindBorderCell(c[0],c[i]);  
  61.   
  62.             switch(GetPos)  
  63.             {  
  64.             case 101:  
  65.                 //Already fixed  
  66.                 break;  
  67.             case 110:  
  68.                 Steps.AddStep(1false1);  
  69.                 Steps.AddStep(0true1);  
  70.                 Steps.AddStep(4false1);  
  71.                 Steps.AddStep(0false1);  
  72.                 break;                
  73.             case 140:  
  74.                 Steps.AddStep(4true1);  
  75.                 Steps.AddStep(1true1);  
  76.                 break;  
  77.             case 104:  
  78.                 Steps.AddStep(4true1);  
  79.                 Steps.AddStep(0true1);  
  80.                 Steps.AddStep(4false1);  
  81.                 Steps.AddStep(0false1);  
  82.                 break;  
  83.             case 130:  
  84.                 Steps.AddStep(3true1);  
  85.                 Steps.AddStep(0true1);  
  86.                 Steps.AddStep(4true1);  
  87.                 Steps.AddStep(0false1);  
  88.                 break;  
  89.             case 103:  
  90.                 Steps.AddStep(3true1);  
  91.                 Steps.AddStep(0true2);  
  92.                 Steps.AddStep(3false1);  
  93.                 Steps.AddStep(0false2);  
  94.                 break;  
  95.             case 150:  
  96.                 Steps.AddStep(5false1);  
  97.                 Steps.AddStep(1false1);  
  98.                 break;  
  99.             case 105:  
  100.                 Steps.AddStep(5false1);  
  101.                 Steps.AddStep(0false1);  
  102.                 Steps.AddStep(5true1);  
  103.                 Steps.AddStep(0true1);  
  104.                 break;  
  105.             case 241:  
  106.                 Steps.AddStep(1true1);  
  107.                 break;  
  108.             case 214:  
  109.                 Steps.AddStep(0true1);  
  110.                 Steps.AddStep(4false1);  
  111.                 Steps.AddStep(0false1);  
  112.                 break;  
  113.             case 243:  
  114.                 Steps.AddStep(4true2);  
  115.                 Steps.AddStep(1true1);  
  116.                 Steps.AddStep(4true2);  
  117.                 break;  
  118.             case 234:  
  119.                 Steps.AddStep(0true1);  
  120.                 Steps.AddStep(4true1);  
  121.                 Steps.AddStep(0false1);  
  122.                 break;  
  123.             case 253:  
  124.                 Steps.AddStep(5true2);  
  125.                 Steps.AddStep(1false1);  
  126.                 Steps.AddStep(5true2);  
  127.                 break;  
  128.             case 235:  
  129.                 Steps.AddStep(0false1);  
  130.                 Steps.AddStep(5false1);  
  131.                 Steps.AddStep(0true1);  
  132.                 break;  
  133.             case 251:  
  134.                 Steps.AddStep(1false1);  
  135.                 break;  
  136.             case 215:  
  137.                 Steps.AddStep(0false1);  
  138.                 Steps.AddStep(5true1);  
  139.                 Steps.AddStep(0true1);  
  140.                 break;  
  141.             case 312:  
  142.                 Steps.AddStep(2,true,1);  
  143.                 Steps.AddStep(5,true,1);  
  144.                 Steps.AddStep(1,false,1);  
  145.                 Steps.AddStep(5,false,1);  
  146.                 break;  
  147.             case 321:  
  148.                 Steps.AddStep(1,true,2);  
  149.                 break;  
  150.             case 342:  
  151.                 Steps.AddStep(4,false,1);  
  152.                 Steps.AddStep(1,true,1);  
  153.                 Steps.AddStep(4,true,1);  
  154.                 break;  
  155.             case 324:  
  156.                 Steps.AddStep(2,true,1);  
  157.                 Steps.AddStep(1,true,2);  
  158.                 break;  
  159.             case 352:  
  160.                 Steps.AddStep(5,true,1);  
  161.                 Steps.AddStep(1,false,1);  
  162.                 Steps.AddStep(5,false,1);  
  163.                 break;  
  164.             case 325:  
  165.                 Steps.AddStep(2,false,1);  
  166.                 Steps.AddStep(1,true,2);  
  167.                 break;  
  168.             case 332:  
  169.                 Steps.AddStep(2,true,1);  
  170.                 Steps.AddStep(4,false,1);  
  171.                 Steps.AddStep(1,true,1);  
  172.                 Steps.AddStep(4,true,1);  
  173.                 break;  
  174.             case 323:  
  175.                 Steps.AddStep(2,true,2);  
  176.                 Steps.AddStep(1,true,2);  
  177.                 break;  
  178.             default:  
  179.                 //Do nothing  
  180.                 break;  
  181.             }  
  182.               
  183.             for(Steps.Index=CurrentStep;Steps.Index<Steps.Count;Steps.Index++)  
  184.             {  
  185.                 Rubik.RotateRealSide(Steps.Color(), Steps.ClockWise(), Steps.Quarter());  
  186.             }  
  187.             Rubik.ChangeViewToColor(c[0]);  
  188.         }  
  189.     }  
  190.       
  191.     public static void TopCorner() throws Exception  
  192.     {  
  193.         int CurrentStep=Steps.Count;  
  194.         int GetPos=0;  
  195.         int[] c=new int[5];  
  196.         int nTopPos=0;  
  197.         int nOtherPos=0;  
  198.         int nSum=0;  
  199.         boolean bFlag=false;  
  200.           
  201.         c[0]=Rubik.Sides[0][1][1];  
  202.         c[1]=Rubik.Sides[1][1][1];  
  203.         c[2]=Rubik.Sides[5][1][1];  
  204.         c[3]=Rubik.Sides[3][1][1];  
  205.         c[4]=Rubik.Sides[4][1][1];  
  206.           
  207.         for(int i=1;i<5;i++)  
  208.         {  
  209.             Rubik.ChangeViewToColor(c[0]);  
  210.             Rubik.ChangeViewFromTopByNextColor(c[i]);  
  211.               
  212.             int j=i+1;  
  213.             if(j==5) j=1;  
  214.             GetPos=Rubik.FindCornerCell(c[0],c[i],c[j]);  
  215.               
  216.             if(GetPos!=1015)  
  217.             {  
  218.                 //1015 means already fixed  
  219.                 if(GetPos<2000)  
  220.                 {  
  221.                     //In top layer, move to bottom first  
  222.                     CurrentStep=Steps.Count;  
  223.                     nTopPos=GetBit(GetPos,3);  
  224.                     nSum=GetSum(GetPos)-1;  
  225.                     nOtherPos=(nTopPos==0?GetBit(GetPos,1):(nSum-nTopPos));  
  226.                     if(nOtherPos==5 && nSum==6) bFlag=false;  
  227.                     if(nOtherPos==5 && nSum==8) bFlag=true;  
  228.                     if(nOtherPos==3 && nSum==8) bFlag=false;  
  229.                     if(nOtherPos==3 && nSum==7) bFlag=true;  
  230.                     if(nOtherPos==4 && nSum==7) bFlag=false;  
  231.                     if(nOtherPos==4 && nSum==5) bFlag=true;  
  232.                     if(nOtherPos==1 && nSum==5) bFlag=false;  
  233.                     if(nOtherPos==1 && nSum==6) bFlag=true;  
  234.   
  235.                     Steps.AddStep(nOtherPos, bFlag, 1);  
  236.                     Steps.AddStep(2, !bFlag, 1);  
  237.                     Steps.AddStep(nOtherPos, !bFlag, 1);  
  238.                       
  239.                     for(Steps.Index=CurrentStep;Steps.Index<Steps.Count;Steps.Index++)  
  240.                     {  
  241.                         Rubik.RotateRealSide(Steps.Color(), Steps.ClockWise(), Steps.Quarter());  
  242.                     }  
  243.                     Rubik.ChangeViewToColor(c[0]);  
  244.                     Rubik.ChangeViewFromTopByNextColor(c[i]);  
  245.                     GetPos=Rubik.FindCornerCell(c[0],c[i],c[j]);  
  246.                 }  
  247.                   
  248.                 //Now the block has move to bottom, or alreay at bottom  
  249.                 CurrentStep=Steps.Count;  
  250.                 nSum=GetSum(GetPos)-2-2//1st"2":Bottom; 2nd"2":Layer   
  251.                 if(nSum==8) Steps.AddStep(2false1);  
  252.                 if(nSum==7) Steps.AddStep(2true2);  
  253.                 if(nSum==5) Steps.AddStep(2true1);  
  254.                 for(Steps.Index=CurrentStep;Steps.Index<Steps.Count;Steps.Index++)  
  255.                 {  
  256.                     Rubik.RotateRealSide(Steps.Color(), Steps.ClockWise(), Steps.Quarter());  
  257.                 }  
  258.                 //Now the block is just under the bottom of current corner  
  259.                 CurrentStep=Steps.Count;  
  260.                 Rubik.ChangeViewToColor(c[0]);  
  261.                 Rubik.ChangeViewFromTopByNextColor(c[i]);  
  262.                 GetPos=Rubik.FindCornerCell(c[0],c[i],c[j]);  
  263.                 nTopPos=GetBit(GetPos,3);  
  264.                 nSum=GetSum(GetPos)-2-2;  
  265.   
  266.                 if(nSum!=6)  
  267.                 {  
  268.                     //Error  
  269.                     return;  
  270.                 }  
  271.   
  272.                 if(nTopPos==1)  
  273.                 {  
  274.                     Steps.AddStep(1true1);  
  275.                     Steps.AddStep(2true1);  
  276.                     Steps.AddStep(1false1);  
  277.                 }  
  278.                 if(nTopPos==5)  
  279.                 {  
  280.                     Steps.AddStep(5false1);  
  281.                     Steps.AddStep(2false1);  
  282.                     Steps.AddStep(5true1);  
  283.                 }  
  284.                 if(nTopPos==2)  
  285.                 {  
  286.                     Steps.AddStep(1true1);  
  287.                     Steps.AddStep(2false,1);  
  288.                     Steps.AddStep(1false1);  
  289.                     Steps.AddStep(5false1);  
  290.                     Steps.AddStep(2true2);  
  291.                     Steps.AddStep(5true1);  
  292.                 }  
  293.                   
  294.                 for(Steps.Index=CurrentStep;Steps.Index<Steps.Count;Steps.Index++)  
  295.                 {  
  296.                     Rubik.RotateRealSide(Steps.Color(), Steps.ClockWise(), Steps.Quarter());  
  297.                 }  
  298.             }  
  299.         }  
  300.         Rubik.ChangeViewToColor(c[0]);  
  301.     }  
  302.       
  303.     public static void SecondLayer() throws Exception  
  304.     {  
  305.         int CurrentStep=Steps.Count;  
  306.         int GetPos=0, cu=0,cb=0;  //CU:color on under side; CB: color on back side  
  307.         int Center1=0, Center2=0//Center1, the rotate center; center2, theother center besides it   
  308.         int ErrC1=0,ErrC2=0//ErrC1 and Errc2, the border need to be fixed  
  309.         int[] c=new int[6];  
  310.         boolean bFlag=true, bClockWise=false;  
  311.           
  312.         c[0]=Rubik.Sides[0][1][1];  
  313.         c[1]=Rubik.Sides[1][1][1];  
  314.         c[2]=Rubik.Sides[5][1][1];  
  315.         c[3]=Rubik.Sides[3][1][1];  
  316.         c[4]=Rubik.Sides[4][1][1];  
  317.         c[5]=Rubik.Sides[2][1][1];  
  318.           
  319.         //select from the buttom to move to second layer  
  320.         while(bFlag)  
  321.         {  
  322.             bFlag=false;  
  323.             ErrC1=0;  
  324.             for(int i=1;i<5;i++)  
  325.             {  
  326.                 Rubik.ChangeViewToColor(c[0]);  
  327.                 Rubik.ChangeViewFromTopByNextColor(c[i]);  
  328.                 cu=Rubik.Sides[2][1][0];  
  329.                 cb=Rubik.Sides[1][1][2];  
  330.   
  331.                 if(cu!=c[5] && cb!=c[5])  
  332.                 {  
  333.                     //This one can be moved to second layer  
  334.                     CurrentStep=Steps.Count;  
  335.                     bFlag=true;  
  336.                     Center1=Rubik.FindCenter(cu);  
  337.                     Center2=Rubik.FindCenter(cb);  
  338.                     //Move to the opposite  
  339.                     if(Center1==1) Steps.AddStep(2true2);  
  340.                     if(Center1==5) Steps.AddStep(2false1);  
  341.                     if(Center1==4) Steps.AddStep(2true1);  
  342.                     //Set the direction of rotate  
  343.                     if(Center1==1 && Center2==5) bClockWise=true;  
  344.                     if(Center1==1 && Center2==4) bClockWise=false;  
  345.                     if(Center1==5 && Center2==3) bClockWise=true;  
  346.                     if(Center1==5 && Center2==1) bClockWise=false;  
  347.                     if(Center1==3 && Center2==4) bClockWise=true;  
  348.                     if(Center1==3 && Center2==5) bClockWise=false;  
  349.                     if(Center1==4 && Center2==1) bClockWise=true;  
  350.                     if(Center1==4 && Center2==3) bClockWise=false;  
  351.                     //Start rotate  
  352.                     Steps.AddStep(Center1, bClockWise, 1);  
  353.                     Steps.AddStep(2, !bClockWise, 1);  
  354.                     Steps.AddStep(Center1, !bClockWise, 1);  
  355.                     Steps.AddStep(2, !bClockWise, 1);  
  356.                     Steps.AddStep(Center2, !bClockWise, 1);  
  357.                     Steps.AddStep(2, bClockWise, 1);  
  358.                     Steps.AddStep(Center2, bClockWise, 1);  
  359.                     //Actions  
  360.                     for(Steps.Index=CurrentStep;Steps.Index<Steps.Count;Steps.Index++)  
  361.                     {  
  362.                         Rubik.RotateRealSide(Steps.Color(), Steps.ClockWise(), Steps.Quarter());  
  363.                     }  
  364.                     Rubik.ChangeViewToColor(c[0]);  
  365.                     break;  
  366.                 }  
  367.                   
  368.                 //Check if the sencond layer is ok  
  369.                 if(!bFlag && ErrC1==0)  
  370.                 {  
  371.                     if(Rubik.Sides[1][1][1]!=Rubik.Sides[1][0][1] || Rubik.Sides[5][1][1]!=Rubik.Sides[5][1][2])  
  372.                     {  
  373.                         ErrC1=Rubik.Sides[1][1][1];  
  374.                         ErrC2=Rubik.Sides[5][1][1];  
  375.                     }  
  376.                 }  
  377.             }  
  378.         }  
  379.           
  380.         //Now All the blocks in bottom has been moved to second layer  
  381.         if(ErrC1>0)  
  382.         {  
  383.             //if there are still error blocks in second layer, move to bottom first  
  384.             Rubik.RotateRealSide(ErrC1, true1);  
  385.             Rubik.RotateRealSide(c[5], false1);  
  386.             Rubik.RotateRealSide(ErrC1, false1);  
  387.             Rubik.RotateRealSide(c[5], false1);  
  388.             Rubik.RotateRealSide(ErrC2, false1);  
  389.             Rubik.RotateRealSide(c[5], true1);  
  390.             Rubik.RotateRealSide(ErrC2, true1);  
  391.             Rubik.ChangeViewToColor(c[0]);  
  392.             SecondLayer();  
  393.         }  
  394.     }  
  395.   
  396.     public static void BottomCross() throws Exception  
  397.     {  
  398.         int CurrentStep=Steps.Count;  
  399.           
  400.         //Change view to the bottom  
  401.         int c=Rubik.Sides[2][1][1];  
  402.         int b[]=new int[4];  
  403.         int d[]={5,3,4,1};  
  404.         Rubik.ChangeViewToColor(c);  
  405.           
  406.         int nSum=0, nPos=0;  
  407.         b[0]=Rubik.Sides[0][0][1];  
  408.         b[1]=Rubik.Sides[0][1][0];  
  409.         b[2]=Rubik.Sides[0][2][1];  
  410.         b[3]=Rubik.Sides[0][1][2];  
  411.         for(int i=0;i<4;i++)  
  412.         {  
  413.             if(b[i]==c)  
  414.             {  
  415.                 nSum++;  
  416.                 nPos+=d[i];  
  417.             }  
  418.         }  
  419.           
  420.         if(nSum==4return;  
  421.         if(nSum==0)  
  422.         {  
  423.             CurrentStep=Steps.Count;  
  424.             Steps.AddStep(1false1);  
  425.             Steps.AddStep(4false1);  
  426.             Steps.AddStep(0false1);  
  427.             Steps.AddStep(4true1);  
  428.             Steps.AddStep(0true1);  
  429.             Steps.AddStep(1true1);  
  430.             Steps.AddStep(3false1);  
  431.             Steps.AddStep(0false1);  
  432.             Steps.AddStep(5false1);  
  433.             Steps.AddStep(0true1);  
  434.             Steps.AddStep(5true1);  
  435.             Steps.AddStep(3true1);  
  436.         }  
  437.         if(nSum==2)  
  438.         {  
  439.             CurrentStep=Steps.Count;  
  440.             if(nPos==4) Rubik.ChangeViewFromTop(true);  
  441.             if(nPos==4 || nPos==9)  
  442.             {  
  443.                 Steps.AddStep(1false1);  
  444.                 Steps.AddStep(4false1);  
  445.                 Steps.AddStep(0false1);  
  446.                 Steps.AddStep(4true1);  
  447.                 Steps.AddStep(0true1);  
  448.                 Steps.AddStep(1true1);  
  449.             }  
  450.             else  
  451.             {  
  452.                 if(nPos==6) Rubik.ChangeViewFromTop(false);  
  453.                 if(nPos==7) Rubik.ChangeViewFromTop(true);  
  454.                 if(nPos==5)  
  455.                 {  
  456.                     Rubik.ChangeViewFromTop(true);  
  457.                     Rubik.ChangeViewFromTop(true);  
  458.                 }  
  459.                 Steps.AddStep(1false1);  
  460.                 Steps.AddStep(0false1);  
  461.                 Steps.AddStep(4false1);  
  462.                 Steps.AddStep(0true1);  
  463.                 Steps.AddStep(4true1);  
  464.                 Steps.AddStep(1true1);  
  465.             }  
  466.         }  
  467.         for(Steps.Index=CurrentStep;Steps.Index<Steps.Count;Steps.Index++)  
  468.         {  
  469.             Rubik.RotateRealSide(Steps.Color(), Steps.ClockWise(), Steps.Quarter());  
  470.         }  
  471.         Rubik.ChangeViewToColor(c);  
  472.     }  
  473.       
  474.     public static void BottomCorner() throws Exception  
  475.     {  
  476.         int CurrentStep=Steps.Count;  
  477.         int c=Rubik.Sides[0][1][1];  
  478.         int b[]=new int[4];  
  479.         int d[]={5,3,4,1};  
  480.         int Pos2[]={-1,-1};  
  481.         int nSum=0, nPos=0, nFirst=0, nSecond=0;  
  482.         boolean bDirect=true, bMoreTime=false;  
  483.         b[0]=Rubik.Sides[0][0][2];  
  484.         b[1]=Rubik.Sides[0][0][0];  
  485.         b[2]=Rubik.Sides[0][2][0];  
  486.         b[3]=Rubik.Sides[0][2][2];  
  487.         for(int i=0;i<4;i++)  
  488.         {  
  489.             if(b[i]==c)  
  490.             {  
  491.                 nSum++;  
  492.                 nPos=d[i];  
  493.             }  
  494.             else  
  495.             {  
  496.                 if(Pos2[0]==-1) Pos2[0]=i;  
  497.                 else Pos2[1]=i;  
  498.             }  
  499.         }  
  500.           
  501.         if(nSum==4return;  
  502.         if(nSum==1)  
  503.         {  
  504.             Rubik.ChangeViewFromTopByNextColor(Rubik.Sides[nPos][1][1]);  
  505.             bDirect=(Rubik.Sides[1][0][0]==c);  
  506.             if(bDirect) nFirst=5;  
  507.             else nFirst=3;  
  508.             Steps.Clear();  
  509.             Steps.AddStep(nFirst, bDirect, 1);  
  510.             Steps.AddStep(0, bDirect, 1);  
  511.             Steps.AddStep(nFirst, !bDirect, 1);  
  512.             Steps.AddStep(0, bDirect, 1);  
  513.             Steps.AddStep(nFirst, bDirect, 1);  
  514.             Steps.AddStep(0, bDirect, 2);  
  515.             Steps.AddStep(nFirst, !bDirect, 1);  
  516.         }  
  517.         if(nSum==2)  
  518.         {  
  519.             for(int i=0;i<Pos2[0];i++) Rubik.ChangeViewFromTop(true);  
  520.             bDirect=(Rubik.Sides[1][0][0]==c);  
  521.             nFirst=bDirect?5:1;  
  522.             nSecond=6-nFirst;  
  523.             Steps.Clear();  
  524.             Steps.AddStep(nFirst, bDirect, 1);  
  525.             Steps.AddStep(nSecond, !bDirect, 1);  
  526.             Steps.AddStep(nFirst, !bDirect, 1);  
  527.             Steps.AddStep(nSecond, bDirect, 1);  
  528.             Steps.AddStep(nFirst, bDirect, 1);  
  529.             Steps.AddStep(nSecond, !bDirect, 1);  
  530.             Steps.AddStep(nFirst, !bDirect, 1);  
  531.             Steps.AddStep(nSecond, bDirect, 1);  
  532.             Steps.AddStep(0true, Pos2[1]-Pos2[0]);  
  533.             Steps.AddStep(nSecond, !bDirect, 1);  
  534.             Steps.AddStep(nFirst, bDirect, 1);  
  535.             Steps.AddStep(nSecond, bDirect, 1);  
  536.             Steps.AddStep(nFirst, !bDirect, 1);  
  537.             Steps.AddStep(nSecond, !bDirect, 1);  
  538.             Steps.AddStep(nFirst, bDirect, 1);  
  539.             Steps.AddStep(nSecond, bDirect, 1);  
  540.             Steps.AddStep(nFirst, !bDirect, 1);  
  541.         }  
  542.         if(nSum==0)  
  543.         {  
  544.             bMoreTime=true;  
  545.             for(int i=0;i<4;i++)  
  546.             {  
  547.                 if(Rubik.Sides[1][0][0]==c && Rubik.Sides[1][2][0]==c) break;  
  548.                 Rubik.ChangeViewFromTop(true);  
  549.             }  
  550.             nFirst=3;  
  551.             bDirect=false;  
  552.             Steps.Clear();  
  553.             Steps.AddStep(nFirst, bDirect, 1);  
  554.             Steps.AddStep(0, bDirect, 1);  
  555.             Steps.AddStep(nFirst, !bDirect, 1);  
  556.             Steps.AddStep(0, bDirect, 1);  
  557.             Steps.AddStep(nFirst, bDirect, 1);  
  558.             Steps.AddStep(0, bDirect, 2);  
  559.             Steps.AddStep(nFirst, !bDirect, 1);  
  560.         }  
  561.         for(Steps.Index=CurrentStep;Steps.Index<Steps.Count;Steps.Index++)  
  562.         {  
  563.             Rubik.RotateRealSide(Steps.Color(), Steps.ClockWise(), Steps.Quarter());  
  564.         }  
  565.         Rubik.ChangeViewToColor(c);  
  566.         if(bMoreTime) BottomCorner();  
  567.     }  
  568.       
  569.     public static void ThirdLayerCorner() throws Exception  
  570.     {  
  571.         int CurrentStep=Steps.Count;  
  572.         int c=Rubik.Sides[0][1][1];  
  573.         boolean bMoreTime=true;  
  574.   
  575.         for(int i=0;i<4;i++)  
  576.         {  
  577.             if(Rubik.Sides[1][0][0] == Rubik.Sides[1][2][0])  
  578.             {  
  579.                 if(Rubik.Sides[5][2][0] == Rubik.Sides[5][2][2]) return;  
  580.                 else  
  581.                 {  
  582.                     bMoreTime=false;  
  583.                     break;  
  584.                 }  
  585.             }  
  586.             Rubik.ChangeViewFromTop(true);  
  587.         }  
  588.   
  589.         Steps.AddStep(5true1);  
  590.         Steps.AddStep(3false1);  
  591.         Steps.AddStep(5true1);  
  592.         Steps.AddStep(1true2);  
  593.         Steps.AddStep(5false1);  
  594.         Steps.AddStep(3true1);  
  595.         Steps.AddStep(5true1);  
  596.         Steps.AddStep(1true2);  
  597.         Steps.AddStep(5true2);  
  598.           
  599.         for(Steps.Index=CurrentStep;Steps.Index<Steps.Count;Steps.Index++)  
  600.         {  
  601.             Rubik.RotateRealSide(Steps.Color(), Steps.ClockWise(), Steps.Quarter());  
  602.         }  
  603.   
  604.         Rubik.ChangeViewToColor(c);  
  605.         if(bMoreTime) ThirdLayerCorner();  
  606.     }  
  607.       
  608.     public static void ThirdLayerCornerSnap() throws Exception  
  609.     {  
  610.         int c=Rubik.Sides[0][1][1];  
  611.         int nBorderColor=Rubik.Sides[1][0][0];  
  612.         int nCenter=Rubik.FindCenter(nBorderColor);  
  613.         int CurrentStep=Steps.Count;  
  614.   
  615.         if(nCenter==5) Steps.AddStep(0false1);  
  616.         if(nCenter==3) Steps.AddStep(0false2);  
  617.         if(nCenter==4) Steps.AddStep(0true1);  
  618.           
  619.         for(Steps.Index=CurrentStep;Steps.Index<Steps.Count;Steps.Index++)  
  620.         {  
  621.             Rubik.RotateRealSide(Steps.Color(), Steps.ClockWise(), Steps.Quarter());  
  622.         }  
  623.           
  624.         Rubik.ChangeViewToColor(c);  
  625.     }  
  626.   
  627.     public static void ThirdLayerBorderSnap() throws Exception  
  628.     {  
  629.         int c=Rubik.Sides[0][1][1];  
  630.         boolean bMoreTime=true;  
  631.         boolean bDirect=true;  
  632.   
  633.         for(int i=0;i<4;i++)  
  634.         {  
  635.             if(Rubik.Sides[1][0][0] == Rubik.Sides[1][1][0])  
  636.             {  
  637.                 if(Rubik.Sides[5][2][0] == Rubik.Sides[5][2][1]) return;  
  638.                 else  
  639.                 {  
  640.                     bDirect=(Rubik.Sides[5][2][1]==Rubik.Sides[4][1][1]);  
  641.                     bMoreTime=false;  
  642.                     break;  
  643.                 }  
  644.             }  
  645.             Rubik.ChangeViewFromTop(true);  
  646.         }  
  647.           
  648.         int CurrentStep=Steps.Count;  
  649.           
  650.         Steps.AddStep(3true2);  
  651.         Steps.AddStep(0, bDirect, 1);  
  652.         Steps.AddStep(4false1);  
  653.         Steps.AddStep(5true1);  
  654.         Steps.AddStep(3true2);  
  655.         Steps.AddStep(5false1);  
  656.         Steps.AddStep(4true1);  
  657.         Steps.AddStep(0, bDirect, 1);  
  658.         Steps.AddStep(3true2);  
  659.           
  660.         for(Steps.Index=CurrentStep;Steps.Index<Steps.Count;Steps.Index++)  
  661.         {  
  662.             Rubik.RotateRealSide(Steps.Color(), Steps.ClockWise(), Steps.Quarter());  
  663.         }  
  664.   
  665.         Rubik.ChangeViewToColor(c);  
  666.         if(bMoreTime) ThirdLayerBorderSnap();  
  667.     }  
  668.       
  669.     public static int GetBit(int n, int m)  
  670.     {  
  671.         double nFilter=Math.pow(10.,m-1);  
  672.         n=(int) Math.floor(n/nFilter);  
  673.         return n%10;  
  674.     }  
  675.       
  676.     public static int GetSum(int n)  
  677.     {  
  678.         int nReturn=0;  
  679.         while(n>0)  
  680.         {  
  681.             nReturn+=n%10;  
  682.             n=(n-n%10)/10;  
  683.         }  
  684.         return nReturn;  
  685.     }  
  686.       
  687.     public static class Rubik  
  688.     {  
  689.         static int[][][] Sides=new int [7][3][3];  
  690.         static int[] Position=new int[6];  
  691.           
  692.         public static String ImportColor(String[] SideColors)  
  693.         {  
  694.             try  
  695.             {  
  696.                 int Check[]={0,0,0,0,0,0};  
  697.                 for(int i=0;i<6;i++)  
  698.                 {  
  699.                     String szColors=SideColors[i];  
  700.                     if(szColors.length()!=9return "len(Side"+i+")="+szColors.length();  
  701.                     for(int j=0;j<9;j++)  
  702.                     {  
  703.                         int nColor=Color.Value(szColors.substring(j,j+1));  
  704.                         if(nColor==0return "Side"+i+","+j+"="+szColors.substring(j,j+1);  
  705.                         int y=j%3;  
  706.                         int x=(j-y)/3;  
  707.                         Check[nColor-1]++;  
  708.                         Sides[i][x][y]=nColor;  
  709.                         if(j==4) Position[i]=nColor;  
  710.                     }  
  711.                 }  
  712.                 for(int i=0;i<6;i++)  
  713.                 {  
  714.                     if(Check[i]!=9return "Check"+i+"="+Check[i];  
  715.                 }  
  716.                 return "";  
  717.             }  
  718.             catch(Exception e)  
  719.             {  
  720.                 return e.getMessage();  
  721.             }  
  722.         }  
  723.       
  724.         public static void ChangeViewToColor(int nColor) throws Exception  
  725.         {  
  726.             int nNewCenter=-1;  
  727.             for(int i=0;i<6;i++)  
  728.             {  
  729.                 if(Sides[i][1][1]==nColor) nNewCenter=i;  
  730.             }  
  731.               
  732.             if(nNewCenter==0return;  
  733.             if(nNewCenter==1)  
  734.             {  
  735.                 CopyMatrics(0,6,0);  
  736.                 CopyMatrics(1,0,0);  
  737.                 CopyMatrics(2,1,0);  
  738.                 CopyMatrics(3,2,0);  
  739.                 CopyMatrics(6,3,0);  
  740.                 CopyMatrics(5,6,0);  
  741.                 CopyMatrics(6,5,1);  
  742.                 CopyMatrics(4,6,0);  
  743.                 CopyMatrics(6,4,2);  
  744.             }  
  745.             if(nNewCenter==2)  
  746.             {  
  747.                 CopyMatrics(0,6,0);  
  748.                 CopyMatrics(2,0,0);  
  749.                 CopyMatrics(6,2,0);  
  750.                 CopyMatrics(1,6,0);  
  751.                 CopyMatrics(3,1,0);  
  752.                 CopyMatrics(6,3,0);  
  753.                 CopyMatrics(5,6,0);  
  754.                 CopyMatrics(6,5,3);  
  755.                 CopyMatrics(4,6,0);  
  756.                 CopyMatrics(6,4,3);  
  757.             }  
  758.             if(nNewCenter==3)  
  759.             {  
  760.                 CopyMatrics(0,6,0);  
  761.                 CopyMatrics(3,0,0);  
  762.                 CopyMatrics(2,3,0);  
  763.                 CopyMatrics(1,2,0);  
  764.                 CopyMatrics(6,1,0);  
  765.                 CopyMatrics(5,6,0);  
  766.                 CopyMatrics(6,5,2);  
  767.                 CopyMatrics(4,6,0);  
  768.                 CopyMatrics(6,4,1);  
  769.             }  
  770.             if(nNewCenter==4)  
  771.             {  
  772.                 CopyMatrics(0,6,0);  
  773.                 CopyMatrics(4,0,0);  
  774.                 CopyMatrics(2,4,3);  
  775.                 CopyMatrics(5,2,3);  
  776.                 CopyMatrics(6,5,0);  
  777.                 CopyMatrics(3,6,0);  
  778.                 CopyMatrics(6,3,2);  
  779.                 CopyMatrics(1,6,0);  
  780.                 CopyMatrics(6,1,1);  
  781.             }  
  782.             if(nNewCenter==5)  
  783.             {  
  784.                 CopyMatrics(0,6,0);  
  785.                 CopyMatrics(5,0,0);  
  786.                 CopyMatrics(2,5,3);  
  787.                 CopyMatrics(4,2,3);  
  788.                 CopyMatrics(6,4,0);  
  789.                 CopyMatrics(3,6,0);  
  790.                 CopyMatrics(6,3,1);  
  791.                 CopyMatrics(1,6,0);  
  792.                 CopyMatrics(6,1,2);  
  793.             }  
  794.         }  
  795.           
  796.         public static void CopyMatrics(int A, int B, int n) throws Exception  
  797.         {  
  798.             //Copy from A to B  
  799.             //n=0:DirectCopy  1:ClockWiseCopy  2:AntiClockCop  3:Reverse copy  
  800.             for(int i=0;i<3;i++)  
  801.             {  
  802.                 for(int j=0;j<3;j++)  
  803.                 {  
  804.                     if(n==0) Sides[B][i][j]=Sides[A][i][j];  
  805.                     if(n==1) Sides[B][j][2-i]=Sides[A][i][j];  
  806.                     if(n==2) Sides[B][2-j][i]=Sides[A][i][j];  
  807.                     if(n==3) Sides[B][i][j]=Sides[A][2-i][2-j];  
  808.                 }  
  809.             }  
  810.         }  
  811.       
  812.         public static void ChangeViewFromTopByNextColor(int nColor) throws Exception  
  813.         {  
  814.             int nNextColorCenter=-1;  
  815.             for(int i=0;i<6;i++)  
  816.             {  
  817.                 if(Sides[i][1][1]==nColor) nNextColorCenter=i;  
  818.             }  
  819.               
  820.             if(nNextColorCenter==4) ChangeViewFromTop(false);  
  821.             if(nNextColorCenter==5) ChangeViewFromTop(true);  
  822.             if(nNextColorCenter==3)  
  823.             {  
  824.                 ChangeViewFromTop(true);  
  825.                 ChangeViewFromTop(true);  
  826.             }  
  827.         }  
  828.           
  829.         public static void ChangeViewFromTop(boolean ClockWise) throws Exception  
  830.         {  
  831.             int Next1=3,Next2=1;  
  832.             if(!ClockWise) {Next1=1;Next2=3;}  
  833.               
  834.             int nType=ClockWise?1:2;  
  835.             CopyMatrics(0,6,0);  
  836.             CopyMatrics(6,0,nType);  
  837.             CopyMatrics(5,6,0);  
  838.             CopyMatrics(Next1,5,nType);  
  839.             CopyMatrics(4,Next1,nType);  
  840.             CopyMatrics(Next2,4,nType);  
  841.             CopyMatrics(6,Next2,nType);  
  842.             CopyMatrics(2,6,0);  
  843.             CopyMatrics(6,2,3-nType);  
  844.         }  
  845.   
  846.         public static void RotateBottomSide(boolean ClockWise) throws Exception  
  847.         {  
  848.             int temp=0;  
  849.             int i;  
  850.               
  851.             CopyMatrics(2,6,ClockWise?2:1); //Bottom ClockWise = Top Anti-ClockWise  
  852.             CopyMatrics(6,2,0);  
  853.             if(ClockWise)  
  854.             {  
  855.                 for(i=0;i<3;i++)  
  856.                 {  
  857.                     temp=Sides[5][0][i];  
  858.                     Sides[5][0][i]=Sides[3][2-i][0];  
  859.                     Sides[3][2-i][0]=Sides[4][2][2-i];  
  860.                     Sides[4][2][2-i]=Sides[1][i][2];  
  861.                     Sides[1][i][2]=temp;  
  862.                 }  
  863.             }  
  864.             else  
  865.             {  
  866.                 for(i=0;i<3;i++)  
  867.                 {  
  868.                     temp=Sides[5][0][i];  
  869.                     Sides[5][0][i]=Sides[1][i][2];  
  870.                     Sides[1][i][2]=Sides[4][2][2-i];  
  871.                     Sides[4][2][2-i]=Sides[3][2-i][0];  
  872.                     Sides[3][2-i][0]=temp;  
  873.                 }  
  874.             }  
  875.         }  
  876.           
  877.         public static void RotateRealSide(int nColor, boolean ClockWise, int nQuarter) throws Exception  
  878.         {  
  879.             //ClockWise means AntiClockWise from Top, and nCount>0 in Robot Class  
  880.             int nCenter=-1;  
  881.             int[] arOpposite={2,3,0,1,5,4};  
  882.             for(int i=0;i<6;i++)  
  883.             {  
  884.                 if(Position[i]==nColor) nCenter=i;  
  885.             }  
  886.             int nOppositeColor=Position[arOpposite[nCenter]];  
  887.               
  888.             if(nCenter==2)  
  889.             {  
  890.                 //Do Nothing  
  891.             }  
  892.             if(nCenter==1)  
  893.             {  
  894.                 RotatePaw();  
  895.             }  
  896.             if(nCenter==0)  
  897.             {  
  898.                 RotatePaw();  
  899.                 RotatePaw();  
  900.             }  
  901.             if(nCenter==3)  
  902.             {  
  903.                 RotateBottom(false);  
  904.                 RotateBottom(false);  
  905.                 RotatePaw();  
  906.             }  
  907.             if(nCenter==4)  
  908.             {  
  909.                 RotateBottom(false);  
  910.                 RotatePaw();  
  911.             }  
  912.             if(nCenter==5)  
  913.             {  
  914.                 RotateBottom(true);  
  915.                 RotatePaw();  
  916.             }  
  917.             ChangeViewToColor(nOppositeColor);  
  918.               
  919.             for(int i=0;i<nQuarter;i++)  
  920.             {  
  921.                 RotateBottomSide(!ClockWise);  
  922.             }  
  923.         }     
  924.   
  925.         public static void RotateBottom(boolean ClockWise) throws Exception  
  926.         {  
  927.             if(ClockWise)  
  928.             {  
  929.                 int n=Position[5];  
  930.                 Position[5]=Position[3];  
  931.                 Position[3]=Position[4];  
  932.                 Position[4]=Position[1];  
  933.                 Position[1]=n;  
  934.             }  
  935.             else  
  936.             {  
  937.                 int n=Position[5];  
  938.                 Position[5]=Position[1];  
  939.                 Position[1]=Position[4];  
  940.                 Position[4]=Position[3];  
  941.                 Position[3]=n;  
  942.             }  
  943.         }  
  944.           
  945.         public static void RotatePaw() throws Exception  
  946.         {  
  947.             //Only can move forward  
  948.             int n=Position[0];  
  949.             Position[0]=Position[3];  
  950.             Position[3]=Position[2];  
  951.             Position[2]=Position[1];  
  952.             Position[1]=n;  
  953.         }  
  954.           
  955.         public static int FindCenter(int nColor) throws Exception  
  956.         {  
  957.             int nCenter=-1;  
  958.             for(int i=0;i<6;i++)  
  959.             {  
  960.                 if(Sides[i][1][1]==nColor) nCenter=i;  
  961.             }  
  962.             return nCenter;  
  963.         }  
  964.               
  965.         public static int FindCornerCell(int Color1, int Color2, int Color3)  
  966.         {  
  967.             //return value=nLayer*1000+nFirstColorCenter*100+nSecondColorCenter*10+nThirdCenter  
  968.             int nReturn=0;  
  969.             int nCheck=Color1*100+Color2*10+Color3;  
  970.               
  971.             //First Layer  
  972.             if(nReturn==0) nReturn=CheckCorner(nCheck,Sides[0][0][2],Sides[5][2][2],Sides[1][0][0],0,5,1);  
  973.             if(nReturn==0) nReturn=CheckCorner(nCheck,Sides[0][0][0],Sides[5][2][0],Sides[3][0][2],0,5,3);  
  974.             if(nReturn==0) nReturn=CheckCorner(nCheck,Sides[0][2][0],Sides[4][0][0],Sides[3][2][2],0,4,3);  
  975.             if(nReturn==0) nReturn=CheckCorner(nCheck,Sides[0][2][2],Sides[4][0][2],Sides[1][2][0],0,4,1);  
  976.             if(nReturn>0return 1000+nReturn;  
  977.   
  978.             if(nReturn==0) nReturn=CheckCorner(nCheck,Sides[2][0][0],Sides[5][0][2],Sides[1][0][2],2,5,1);  
  979.             if(nReturn==0) nReturn=CheckCorner(nCheck,Sides[2][0][2],Sides[5][0][0],Sides[3][0][0],2,5,3);  
  980.             if(nReturn==0) nReturn=CheckCorner(nCheck,Sides[2][2][2],Sides[4][2][0],Sides[3][2][0],2,4,3);  
  981.             if(nReturn==0) nReturn=CheckCorner(nCheck,Sides[2][2][0],Sides[4][2][2],Sides[1][2][2],2,4,1);  
  982.             if(nReturn>0return 2000+nReturn;  
  983.             return 0;  
  984.         }  
  985.   
  986.         public static int CheckCorner(int CheckValue, int c1, int c2, int c3, int p1, int p2, int p3)  
  987.         {  
  988.             if(c1*100+c2*10+c3 == CheckValue) return p1*100+p2*10+p3;  
  989.             if(c1*100+c3*10+c2 == CheckValue) return p1*100+p3*10+p2;  
  990.             if(c2*100+c1*10+c3 == CheckValue) return p2*100+p1*10+p3;  
  991.             if(c2*100+c3*10+c1 == CheckValue) return p2*100+p3*10+p1;  
  992.             if(c3*100+c1*10+c2 == CheckValue) return p3*100+p1*10+p2;  
  993.             if(c3*100+c2*10+c1 == CheckValue) return p3*100+p2*10+p1;  
  994.             return 0;  
  995.         }  
  996.           
  997.         public static int FindBorderCell(int Color1, int Color2)  
  998.         {  
  999.             //return value=nLayer*100+nFirstColorCenter*10+nSecondColorCenter  
  1000.             int nReturn=0;  
  1001.             int c1=0,c2=0;  
  1002.             //First layer  
  1003.             c1=Sides[0][0][1]; c2=Sides[5][2][1];  
  1004.             if(c1==Color1 && c2==Color2) return 105;  
  1005.             if(c1==Color2 && c2==Color1) return 150;  
  1006.             c1=Sides[0][1][0]; c2=Sides[3][1][2];  
  1007.             if(c1==Color1 && c2==Color2) return 103;  
  1008.             if(c1==Color2 && c2==Color1) return 130;  
  1009.             c1=Sides[0][2][1]; c2=Sides[4][0][1];  
  1010.             if(c1==Color1 && c2==Color2) return 104;  
  1011.             if(c1==Color2 && c2==Color1) return 140;  
  1012.             c1=Sides[0][1][2]; c2=Sides[1][1][0];  
  1013.             if(c1==Color1 && c2==Color2) return 101;  
  1014.             if(c1==Color2 && c2==Color1) return 110;  
  1015.             //Seconde Layer  
  1016.             c1=Sides[4][1][2]; c2=Sides[1][2][1];  
  1017.             if(c1==Color1 && c2==Color2) return 241;  
  1018.             if(c1==Color2 && c2==Color1) return 214;              
  1019.             c1=Sides[4][1][0]; c2=Sides[3][2][1];  
  1020.             if(c1==Color1 && c2==Color2) return 243;  
  1021.             if(c1==Color2 && c2==Color1) return 234;              
  1022.             c1=Sides[5][1][0]; c2=Sides[3][0][1];  
  1023.             if(c1==Color1 && c2==Color2) return 253;  
  1024.             if(c1==Color2 && c2==Color1) return 235;              
  1025.             c1=Sides[5][1][2]; c2=Sides[1][0][1];  
  1026.             if(c1==Color1 && c2==Color2) return 251;  
  1027.             if(c1==Color2 && c2==Color1) return 215;  
  1028.             //Third Layer  
  1029.             c1=Sides[4][2][1]; c2=Sides[2][2][1];  
  1030.             if(c1==Color1 && c2==Color2) return 342;  
  1031.             if(c1==Color2 && c2==Color1) return 324;              
  1032.             c1=Sides[1][1][2]; c2=Sides[2][1][0];  
  1033.             if(c1==Color1 && c2==Color2) return 312;  
  1034.             if(c1==Color2 && c2==Color1) return 321;              
  1035.             c1=Sides[5][0][1]; c2=Sides[2][0][1];  
  1036.             if(c1==Color1 && c2==Color2) return 352;  
  1037.             if(c1==Color2 && c2==Color1) return 325;              
  1038.             c1=Sides[3][1][0]; c2=Sides[2][1][2];  
  1039.             if(c1==Color1 && c2==Color2) return 332;  
  1040.             if(c1==Color2 && c2==Color1) return 323;  
  1041.             return 0;  
  1042.         }  
  1043.   
  1044.     }  
  1045.       
  1046.     public static class Steps  
  1047.     {  
  1048.         public static int Count=0;  
  1049.         public static int Index=-1;  
  1050.         private static int[] arColor=new int[200];  
  1051.         private static boolean[] arClockWise=new boolean[200];  
  1052.         private static int[] arQuarter=new int[200];  
  1053.         public static void Clear()  
  1054.         {  
  1055.             Count=0;  
  1056.             Index=-1;  
  1057.         }  
  1058.         public static void AddStep(int SideNum, boolean ClockWise, int Quarter)  
  1059.         {  
  1060.             arColor[Count]=Rubik.Sides[SideNum][1][1];  
  1061.             arClockWise[Count]=ClockWise;  
  1062.             arQuarter[Count]=Quarter;  
  1063.             Count++;  
  1064.         }  
  1065.         public static int Color()  
  1066.         {  
  1067.             return arColor[Index];  
  1068.         }  
  1069.         public static boolean ClockWise()  
  1070.         {  
  1071.             return arClockWise[Index];  
  1072.         }  
  1073.         public static int Quarter()  
  1074.         {  
  1075.             return arQuarter[Index];  
  1076.         }  
  1077.     }  
  1078.   
  1079.     public static class Color  
  1080.     {  
  1081.         public static int Y=1;  
  1082.         public static int B=2;  
  1083.         public static int R=3;  
  1084.         public static int W=4;  
  1085.         public static int O=5;  
  1086.         public static int G=6;  
  1087.           
  1088.         public static String Text(int n)  
  1089.         {  
  1090.             switch(n)  
  1091.             {  
  1092.             case 1:  
  1093.                 return "Y";  
  1094.             case 2:  
  1095.                 return "B";  
  1096.             case 3:  
  1097.                 return "R";  
  1098.             case 4:  
  1099.                 return "W";  
  1100.             case 5:  
  1101.                 return "O";  
  1102.             case 6:  
  1103.                 return "G";  
  1104.             default:  
  1105.                 return n+"";  
  1106.             }  
  1107.         }  
  1108.           
  1109.         public static int Value(String c)  
  1110.         {  
  1111.             if(c.equals("Y")||c.equals("y")) return 1;  
  1112.             if(c.equals("B")||c.equals("b")) return 2;  
  1113.             if(c.equals("R")||c.equals("r")) return 3;  
  1114.             if(c.equals("W")||c.equals("w")) return 4;  
  1115.             if(c.equals("O")||c.equals("o")) return 5;  
  1116.             if(c.equals("G")||c.equals("g")) return 6;  
  1117.             return 0;  
  1118.         }  
  1119.     }  
  1120. }  
  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值