Substituting elements of array to another array element

Hi! Can you please help me with my code? I attach a copy below. Sorry, I unintentionally made it hard to read.``

Firstly, I understand that this is not how code should work.
code concept:
beforeshuffle[] = (1,2,3,4,5,6,7,8)
aftershuffle[] = (5,2,4,1,3,7,6,8)
A = aftershuffle[0,1] = {5,2}
B = aftershuffle[2,3] = {4,1}
C = aftershuffle[4,5] = {3,7}
D = aftershuffle[6,7] = {6,8}
executecode[] = {B,A,C,B,A,D,C,D}
A rotates motor 1 clockwise
B rotates motor 1 anticlockwise
C rotates motor 2 clockwise
D rotates motor 2 anticlockwise

There are problems that I want to avoid or unsure of how to solve:

  1. motors that rotate at irregular timings
  2. checking if the elements is in the array of A,B,C or D. (I would avoid 'if' function if it is possible to substitute like in the picture)
  3. reading executecode "from bottom to top"
  4. confusion of how Arduino interact with circuit

void setup(){}
void loop(){
int executecode[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51};

int questionNumberArray[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51};

int A; int B; int C; int D;

int y;

const size_t n = sizeof(questionNumberArray) / sizeof(questionNumberArray[0]);

for (size_t i = 0; i < n - 1; i++)
{
size_t j = random(0, n - i);

int t = questionNumberArray*;*

_ questionNumberArray = questionNumberArray[j];_
* questionNumberArray[j] = t;*
questionNumberArray[0,1,2,3,4,5,6,7,8,9,10,11,12] = A;
questionNumberArray[13,14,15,16,17,18,19,20,21,22,23,24,25] = B;
questionNumberArray[26,27,28,29,30,31,32,33,34,35,36,37,38] = C;
questionNumberArray[39,40,41,42,43,44,45,46,47,48,49,50,51] = D;
for (y = -1;y <52; y= y + 1){
if (executecode[y]== A);
{pinMode(10,OUTPUT);
pinMode(12,INPUT);
digitalWrite(10,HIGH);
digitalWrite(12,HIGH);}
if (executecode[y]== A);
{pinMode(12,OUTPUT);
pinMode(10,INPUT);
digitalWrite(12,HIGH);
digitalWrite(10,HIGH);}
if (executecode[y]== A);
{pinMode(6,OUTPUT);
pinMode(8,INPUT);
digitalWrite(6,HIGH);
digitalWrite(8,HIGH);}
if (executecode[y]== A);
{pinMode(8,OUTPUT);
pinMode(6,INPUT);
digitalWrite(8,HIGH);
digitalWrite(6,HIGH);}
}
}
}
[code][/code]

The code goes inside the code bookends. Read the sticky posts at the top of the forum.

Please edit your post to add code tags ("</>" button).