Rubik's cube players' obsession adopts the third-order Rubik's cube disruption function implemented by Python, Java and Android

Posted by ivki on Wed, 26 Jan 2022 06:32:12 +0100

First, briefly describe the third-order Rubik's cube. The Rubik's cube can change its state by disrupting the formula,

The six letters (F,B,U,D,L,R) respectively indicate: 90 ° clockwise rotation on the front, 90 ° clockwise rotation on the back, 90 ° clockwise rotation on the top, 90 ° clockwise rotation on the bottom, 90 ° clockwise rotation on the left and 90 ° clockwise rotation on the right.

(F',B',U',D',L',R') six letters respectively indicate: 90 ° counterclockwise rotation in front, 90 ° counterclockwise rotation in back, 90 ° counterclockwise rotation in top, 90 ° counterclockwise rotation in bottom, 90 ° counterclockwise rotation in left and 90 ° counterclockwise rotation in right.

(F2,B2,U2,D2,L2,R2) six letters respectively indicate: the front rotates clockwise by 180 °, the back rotates clockwise by 180 °, the top rotates clockwise by 180 °, the bottom rotates clockwise by 180 °, the left rotates clockwise by 180 °, and the right rotates clockwise by 180 °.

At the beginning of this function, I used Python for coding test

Firstly, six list storage Rubik's cube states are defined. The first nine bits I call the ground state and the last nine bits I call the buffer bit. Due to the variety of magic cube, each rotation affects itself and the four adjacent faces. Encode each block on each face of the magic cube, from top to bottom and from left to right, encoding 0-8 (ground state) and 9-17 (buffer bit).

bai =   ["white","white","white","white","white","white","white","white","white","white","white","white","white","white","white","white","white","white"]
huang = ["yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow"]
lan =   ["blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue"]
lv =    ["green","green","green","green","green","green","green","green","green","green","green","green","green","green","green","green","green","green"]
hong =  ["red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red"]
cheng = ["orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange"]

The following code is to generate a scrambled formula. The content is relatively simple and will not be described too much.

dlstr = ""
dllist = []
dlzb = ["L","R","U","D","F","B","L'","R'","U'","D'","F'","B'","L2","R2","U2","D2","F2","B2"]
for i in range(21):
    j = random.randint(0,17)
    dlstr = dlstr + dlzb[j] + " "
    dllist.append(dlzb[j])
print(dlstr)

When the white side is up and the green side is facing itself, let's take r as an example. When R rotates, the red side will rotate 90 ° clockwise, so the red side will change its position except the central block. The blocks at positions 2, 5 and 8 of the white side will be replaced by green faces 2, 5 and 8. At this time, I use buffer bits to replace them, and other four directions are replaced in this way. Finally, the buffer bit should be reset, that is, the buffer bit should be the same as the ground state for the next rotation.

def turnR():
    bai[2] = lv[11]
    bai[5] = lv[14]
    bai[8] = lv[17]
    lan[0] = bai[17]
    lan[3] = bai[14]
    lan[6] = bai[11]
    huang[2] = lan[15]
    huang[5] = lan[12]
    huang[8] = lan[9]
    lv[2] = huang[11]
    lv[5] = huang[14]
    lv[8] = huang[17]

    hong[0] = hong[15]
    hong[1] = hong[12]
    hong[2] = hong[9]
    hong[3] = hong[16]
    hong[5] = hong[10]
    hong[6] = hong[17]
    hong[7] = hong[14]
    hong[8] = hong[11]
    hcgw()
def hcgw():
    for i in range(9,18):
        bai[i] = bai[i - 9]
        lv[i] = lv[i - 9]
        huang[i] = huang[i - 9]
        lan[i] = lan[i - 9]
        cheng[i] = cheng[i - 9]
        hong[i] = hong[i - 9]

So far, the logical idea of disrupting the third-order magic cube has been clear and complete, and the code is as follows:

import random
def turnL():
    lv[0] = bai[9]
    lv[3] = bai[12]
    lv[6] = bai[15]
    bai[0] = lan[17]
    bai[3] = lan[14]
    bai[6] = lan[11]
    lan[2] = huang[15]
    lan[5] = huang[12]
    lan[8] = huang[9]
    huang[0] = lv[9]
    huang[3] = lv[12]
    huang[6] = lv[15]

    cheng[0] = cheng[15]
    cheng[1] = cheng[12]
    cheng[2] = cheng[9]
    cheng[3] = cheng[16]
    cheng[5] = cheng[10]
    cheng[6] = cheng[17]
    cheng[7] = cheng[14]
    cheng[8] = cheng[11]
    hcgw()
def turnR():
    bai[2] = lv[11]
    bai[5] = lv[14]
    bai[8] = lv[17]
    lan[0] = bai[17]
    lan[3] = bai[14]
    lan[6] = bai[11]
    huang[2] = lan[15]
    huang[5] = lan[12]
    huang[8] = lan[9]
    lv[2] = huang[11]
    lv[5] = huang[14]
    lv[8] = huang[17]

    hong[0] = hong[15]
    hong[1] = hong[12]
    hong[2] = hong[9]
    hong[3] = hong[16]
    hong[5] = hong[10]
    hong[6] = hong[17]
    hong[7] = hong[14]
    hong[8] = hong[11]
    hcgw()
def turnU():
    lv[0] = hong[9]
    lv[1] = hong[10]
    lv[2] = hong[11]
    cheng[0] = lv[9]
    cheng[1] = lv[10]
    cheng[2] = lv[11]
    lan[0] = cheng[9]
    lan[1] = cheng[10]
    lan[2] = cheng[11]
    hong[0] = lan[9]
    hong[1] = lan[10]
    hong[2] = lan[11]

    bai[0] = bai[15]
    bai[1] = bai[12]
    bai[2] = bai[9]
    bai[3] = bai[16]
    bai[5] = bai[10]
    bai[6] = bai[17]
    bai[7] = bai[14]
    bai[8] = bai[11]
    hcgw()
def turnD():
    lv[6] = cheng[15]
    lv[7] = cheng[16]
    lv[8] = cheng[17]
    cheng[6] = lan[15]
    cheng[7] = lan[16]
    cheng[8] = lan[17]
    lan[6] = hong[15]
    lan[7] = hong[16]
    lan[8] = hong[17]
    hong[6] = lv[15]
    hong[7] = lv[16]
    hong[8] = lv[17]

    huang[0] = huang[15]
    huang[1] = huang[12]
    huang[2] = huang[9]
    huang[3] = huang[16]
    huang[5] = huang[10]
    huang[6] = huang[17]
    huang[7] = huang[14]
    huang[8] = huang[11]
    hcgw()
def turnF():
    bai[6] = cheng[17]
    bai[7] = cheng[14]
    bai[8] = cheng[11]
    cheng[2] = huang[9]
    cheng[5] = huang[10]
    cheng[8] = huang[11]
    huang[0] = hong[15]
    huang[1] = hong[12]
    huang[2] = hong[9]
    hong[0] = bai[15]
    hong[3] = bai[16]
    hong[6] = bai[17]

    lv[0] = lv[15]
    lv[1] = lv[12]
    lv[2] = lv[9]
    lv[3] = lv[16]
    lv[5] = lv[10]
    lv[6] = lv[17]
    lv[7] = lv[14]
    lv[8] = lv[11]
    hcgw()
def turnB():
    bai[0] = hong[11]
    bai[1] = hong[14]
    bai[2] = hong[17]
    hong[2] = huang[17]
    hong[5] = huang[16]
    hong[8] = huang[15]
    huang[6] = cheng[9]
    huang[7] = cheng[12]
    huang[8] = cheng[15]
    cheng[0] = bai[11]
    cheng[3] = bai[10]
    cheng[6] = bai[9]

    lan[0] = lan[15]
    lan[1] = lan[12]
    lan[2] = lan[9]
    lan[3] = lan[16]
    lan[5] = lan[10]
    lan[6] = lan[17]
    lan[7] = lan[14]
    lan[8] = lan[11]
    hcgw()
def hcgw():
    for i in range(9,18):
        bai[i] = bai[i - 9]
        lv[i] = lv[i - 9]
        huang[i] = huang[i - 9]
        lan[i] = lan[i - 9]
        cheng[i] = cheng[i - 9]
        hong[i] = hong[i - 9]


# Last nine bit buffer
bai =   ["white","white","white","white","white","white","white","white","white","white","white","white","white","white","white","white","white","white"]
huang = ["yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow"]
lan =   ["blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue"]
lv =    ["green","green","green","green","green","green","green","green","green","green","green","green","green","green","green","green","green","green"]
hong =  ["red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red"]
cheng = ["orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange"]
dlstr = ""
dllist = []
dlzb = ["L","R","U","D","F","B","L'","R'","U'","D'","F'","B'","L2","R2","U2","D2","F2","B2"]
for i in range(21):
    j = random.randint(0,17)
    dlstr = dlstr + dlzb[j] + " "
    dllist.append(dlzb[j])
print(dlstr)
for i in range(21):
    if (dllist[i] == "L"):
        turnL()
    elif(dllist[i] == "R"):
        turnR()
    elif(dllist[i] == "U"):
        turnU()
    elif(dllist[i] == "D"):
        turnD()
    elif(dllist[i] == "F"):
        turnF()
    elif(dllist[i] == "B"):
        turnB()
    elif(dllist[i] == "L'"):
        for j in range(3):
            turnL()
    elif(dllist[i] == "R'"):
        for j in range(3):
            turnR()
    elif(dllist[i] == "U'"):
        for j in range(3):
            turnU()
    elif(dllist[i] == "D'"):
        for j in range(3):
            turnD()
    elif(dllist[i] == "F'"):
        for j in range(3):
            turnF()
    elif(dllist[i] == "B'"):
        for j in range(3):
            turnB()
    elif(dllist[i] == "L2"):
        for j in range(2):
            turnL()
    elif(dllist[i] == "R2"):
        for j in range(2):
            turnR()
    elif(dllist[i] == "U2"):
        for j in range(2):
            turnU()
    elif(dllist[i] == "D2"):
        for j in range(2):
            turnD()
    elif(dllist[i] == "F2"):
        for j in range(2):
            turnF()
    elif(dllist[i] == "B2"):
        for j in range(2):
            turnB()
print("white:   ", bai)
print("green:   ", lv)
print("yellow:   ", huang)
print("blue:   ", lan)
print("orange:   ", cheng)
print("red:   ", hong)

The author's ability was limited, and the code was chaotic at that time.

Operation results:

At this time, the first nine digits of each list are the status of each face.

Next, implement it in Android!

Convert to Java code!

public class CubeUpSetUtil {
//    The first nine standard bits and the last nine buffer bits
    String [] bai = {"white","white","white","white","white","white","white","white","white","white","white","white","white","white","white","white","white","white"};
    String [] huang = {"yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow","yellow"};
    String [] lan =   {"blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue"};
    String [] lv =    {"green","green","green","green","green","green","green","green","green","green","green","green","green","green","green","green","green","green"};
    String [] hong =  {"red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red"};
    String [] cheng = {"orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange","orange"};

//    Buffer homing
    public void hcgw(){
        for(int i = 9; i < 18; i++){
            bai[i] = bai[i - 9];
            lv[i] = lv[i - 9];
            huang[i] = huang[i - 9];
            lan[i] = lan[i - 9];
            cheng[i] = cheng[i - 9];
            hong[i] = hong[i - 9];
        }
    }




//    Turn left clockwise
    public void turnL(){
        lv[0] = bai[9];
        lv[3] = bai[12];
        lv[6] = bai[15];
        bai[0] = lan[17];
        bai[3] = lan[14];
        bai[6] = lan[11];
        lan[2] = huang[15];
        lan[5] = huang[12];
        lan[8] = huang[9];
        huang[0] = lv[9];
        huang[3] = lv[12];
        huang[6] = lv[15];

        cheng[0] = cheng[15];
        cheng[1] = cheng[12];
        cheng[2] = cheng[9];
        cheng[3] = cheng[16];
        cheng[5] = cheng[10];
        cheng[6] = cheng[17];
        cheng[7] = cheng[14];
        cheng[8] = cheng[11];
        hcgw();
    }

//    Turn right clockwise
    public void turnR(){
        bai[2] = lv[11];
        bai[5] = lv[14];
        bai[8] = lv[17];
        lan[0] = bai[17];
        lan[3] = bai[14];
        lan[6] = bai[11];
        huang[2] = lan[15];
        huang[5] = lan[12];
        huang[8] = lan[9];
        lv[2] = huang[11];
        lv[5] = huang[14];
        lv[8] = huang[17];

        hong[0] = hong[15];
        hong[1] = hong[12];
        hong[2] = hong[9];
        hong[3] = hong[16];
        hong[5] = hong[10];
        hong[6] = hong[17];
        hong[7] = hong[14];
        hong[8] = hong[11];
        hcgw();
    }

    //    Turn up clockwise
    public void turnU(){
        lv[0] = hong[9];
        lv[1] = hong[10];
        lv[2] = hong[11];
        cheng[0] = lv[9];
        cheng[1] = lv[10];
        cheng[2] = lv[11];
        lan[0] = cheng[9];
        lan[1] = cheng[10];
        lan[2] = cheng[11];
        hong[0] = lan[9];
        hong[1] = lan[10];
        hong[2] = lan[11];

        bai[0] = bai[15];
        bai[1] = bai[12];
        bai[2] = bai[9];
        bai[3] = bai[16];
        bai[5] = bai[10];
        bai[6] = bai[17];
        bai[7] = bai[14];
        bai[8] = bai[11];
        hcgw();
    }

//    Turn down clockwise
    public void turnD(){
        lv[6] = cheng[15];
        lv[7] = cheng[16];
        lv[8] = cheng[17];
        cheng[6] = lan[15];
        cheng[7] = lan[16];
        cheng[8] = lan[17];
        lan[6] = hong[15];
        lan[7] = hong[16];
        lan[8] = hong[17];
        hong[6] = lv[15];
        hong[7] = lv[16];
        hong[8] = lv[17];

        huang[0] = huang[15];
        huang[1] = huang[12];
        huang[2] = huang[9];
        huang[3] = huang[16];
        huang[5] = huang[10];
        huang[6] = huang[17];
        huang[7] = huang[14];
        huang[8] = huang[11];
        hcgw();
    }

//    Clockwise forward
    public void turnF(){
        bai[6] = cheng[17];
        bai[7] = cheng[14];
        bai[8] = cheng[11];
        cheng[2] = huang[9];
        cheng[5] = huang[10];
        cheng[8] = huang[11];
        huang[0] = hong[15];
        huang[1] = hong[12];
        huang[2] = hong[9];
        hong[0] = bai[15];
        hong[3] = bai[16];
        hong[6] = bai[17];

        lv[0] = lv[15];
        lv[1] = lv[12];
        lv[2] = lv[9];
        lv[3] = lv[16];
        lv[5] = lv[10];
        lv[6] = lv[17];
        lv[7] = lv[14];
        lv[8] = lv[11];
        hcgw();
    }
//    Turn back clockwise
    public void turnB(){
        bai[0] = hong[11];
        bai[1] = hong[14];
        bai[2] = hong[17];
        hong[2] = huang[17];
        hong[5] = huang[16];
        hong[8] = huang[15];
        huang[6] = cheng[9];
        huang[7] = cheng[12];
        huang[8] = cheng[15];
        cheng[0] = bai[11];
        cheng[3] = bai[10];
        cheng[6] = bai[9];

        lan[0] = lan[15];
        lan[1] = lan[12];
        lan[2] = lan[9];
        lan[3] = lan[16];
        lan[5] = lan[10];
        lan[6] = lan[17];
        lan[7] = lan[14];
        lan[8] = lan[11];
        hcgw();
    }

    public List<String[]> getUpSet(String [] dllist) {
        List<String[]> list = new ArrayList<String[]>();
        for (int i = 0; i < dllist.length; i++) {
            if (dllist[i] == "L") {
                turnL();
            } else if (dllist[i] == "R") {
                turnR();
            } else if (dllist[i] == "U") {
                turnU();
            } else if (dllist[i] == "D") {
                turnD();
            } else if (dllist[i] == "F") {
                turnF();
            } else if (dllist[i] == "B") {
                turnB();
            } else if (dllist[i] == "L'") {
                for (int j = 0; j < 3; j++) {
                    turnL();
                }
            } else if (dllist[i] == "R'") {
                for (int j = 0; j < 3; j++) {
                    turnR();
                }
            } else if (dllist[i] == "U'") {
                for (int j = 0; j < 3; j++) {
                    turnU();
                }
            } else if (dllist[i] == "D'") {
                for (int j = 0; j < 3; j++) {
                    turnD();
                }
            } else if (dllist[i] == "F'") {
                for (int j = 0; j < 3; j++) {
                    turnF();
                }
            } else if (dllist[i] == "B'") {
                for (int j = 0; j < 3; j++) {
                    turnB();
                }
            } else if (dllist[i] == "L2") {
                for (int j = 0; j < 2; j++) {
                    turnL();
                }
            } else if (dllist[i] == "R2") {
                for (int j = 0; j < 2; j++) {
                    turnR();
                }
            } else if (dllist[i] == "U2") {
                for (int j = 0; j < 2; j++) {
                    turnU();
                }
            } else if (dllist[i] == "D2") {
                for (int j = 0; j < 2; j++) {
                    turnD();
                }
            } else if (dllist[i] == "F2") {
                for (int j = 0; j < 2; j++) {
                    turnF();
                }
            } else if (dllist[i] == "B2") {
                for (int j = 0; j < 2; j++) {
                    turnB();
                }
            }
        }
        list.add(bai);
        list.add(huang);
        list.add(lan);
        list.add(lv);
        list.add(hong);
        list.add(cheng);
        return list;
    }
}

Get and color the scrambled transition

public void setDlView(List<String[]> list){
        bai1.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(0)[0]).toString()));
        bai2.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(0)[1]).toString()));
        bai3.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(0)[2]).toString()));
        bai4.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(0)[3]).toString()));
        bai5.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(0)[4]).toString()));
        bai6.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(0)[5]).toString()));
        bai7.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(0)[6]).toString()));
        bai8.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(0)[7]).toString()));
        bai9.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(0)[8]).toString()));
//
        huang1.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(1)[0])));
        huang2.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(1)[1])));
        huang3.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(1)[2])));
        huang4.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(1)[3])));
        huang5.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(1)[4])));
        huang6.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(1)[5])));
        huang7.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(1)[6])));
        huang8.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(1)[7])));
        huang9.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(1)[8])));
//
        lan1.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(2)[0])));
        lan2.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(2)[1])));
        lan3.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(2)[2])));
        lan4.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(2)[3])));
        lan5.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(2)[4])));
        lan6.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(2)[5])));
        lan7.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(2)[6])));
        lan8.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(2)[7])));
        lan9.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(2)[8])));
//
        lv1.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(3)[0])));
        lv2.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(3)[1])));
        lv3.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(3)[2])));
        lv4.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(3)[3])));
        lv5.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(3)[4])));
        lv6.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(3)[5])));
        lv7.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(3)[6])));
        lv8.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(3)[7])));
        lv9.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(3)[8])));
//
        hong1.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(4)[0])));
        hong2.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(4)[1])));
        hong3.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(4)[2])));
        hong4.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(4)[3])));
        hong5.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(4)[4])));
        hong6.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(4)[5])));
        hong7.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(4)[6])));
        hong8.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(4)[7])));
        hong9.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(4)[8])));
//
        cheng1.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(5)[0])));
        cheng2.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(5)[1])));
        cheng3.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(5)[2])));
        cheng4.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(5)[3])));
        cheng5.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(5)[4])));
        cheng6.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(5)[5])));
        cheng7.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(5)[6])));
        cheng8.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(5)[7])));
        cheng9.setBackgroundColor(android.graphics.Color.parseColor(ColorChange(list.get(5)[8])));
    }
    public String ColorChange(String color){
        if(color.equals("white")){
            return "#ffffff";
        }else if(color.equals("yellow")){
            return "#ffff00";
        }else if(color.equals("blue")){
            return "#3333ff";
        }else if(color.equals("green")){
            return "#33cc33";
        }else if(color.equals("orange")){
            return "#ff9900";
        }else if(color.equals("red")){
            return "#ff0000";
        }else {
            return "#ffffff";
        }
    }

All right, finished product drawing

 

Hey, hey, finish your personal record!

Attach a set of practice videos.

Finally avg14!!!

Topics: Python Java Android