   patternSpiralTopThenBottom(2);  
   render(1000);
   patternRandomLED(20);
-  /*patternThrowDice();
+  /*
+  patternThrowDice();
    rotate(90);
    render(1000);
-   */}
+   */
+}
 
 void printChar(char chars[], int size)
 { 


    // shift current status of LEDs two columns to the left
    // in order to have two blank space between the chars
    for (int p=0; p<3; p++){
      printMoveLeft();
      // turn last column off to have space between chars
      for (int k=0; k<3; k++) 
        cube[3][0][k] = 0 ;

      // shift bit by bit through the byte 
      // and output the bottom 3 bits to 
      // the right sight  of the cube
      b = font[ch][p];
      for (int k=0; k<3; k++) 
        cube[3][3][k] =  !!(b & (1 << k));

      render(CHARDELAY); // render right side
    }

    // step through each of the 4 bytes of the character array
    for (int i=0; i<charWidth; i++) {
      printMoveLeft();
      // print right side of cube
      if (i+3 < charWidth){  // only last byte in 7x4 fontsize
        bRight = font[ch][i+3];
        for (int k=0; k<2; k++) 
          cube[3][3][k] =  !!(bRight & (1 << k));
      } 
      else {
        for (int k=0; k<2; k++) 
          cube[3][3][k] =  0;
      }

      b = font[ch][i];
      // shift bit by bit through the byte 
      // and output it to the pin
      for (int j=3; j>=0; j--)
        cube[3][j][3] = !!(b & (1 << (3+j)));
      for (int k=2; k>=0; k--) 
        cube[3][0][k] =  !!(b & (1 << k));
      render(CHARDELAY); // render right side, front and left side
    }  
    render(1000);
  }
}

void printMoveLeft(){ // used for shifting chars on the cube one column to the left
  //copy LED status on the left side of the cube one step to the left
  for (int j=3; j>0; j--)
    for (int k=0; k<3; k++) 
      cube[0][j][k] = cube[0][j-1][k] ;

  for (int m=0; m<3; m++){
    for (int j=3; j>=0; j--) //copy top LED status one step to the left
      cube[m][j][3] = cube[m+1][j][3];
    for (int k=2; k>=0; k--) //copy front LED status one step to the left
      cube[m][0][k] = cube[m+1][0][k] ;
  }

  //copy LED status on the right side of the cube one step to the left
  for (int j=1; j<3; j++)
    for (int k=0; k<3; k++) 
      cube[3][j][k] = cube[3][j+1][k] ; 

  render(CHARDELAY);
  for (int k=0; k<3; k++)  // most right LED is off on right side
    cube[3][3][k] = 0; 
  for (int k=0; k<4; k++)  // most right LED is off on top side
    cube[3][k][3] = 0; 
}

void printRandom(char chars[], int size)
{ // pixels of each char turn randomly
  int count, x, z;
  byte b;
  for (int p=0; p<size; p++){
    count = 64;
    clearCube();
    render(100);

    char ch = chars[p];
    if (ch < 32 || ch > 126)
      ch = 32;
    ch -= 32;

    while(count > 0){
      x = random(4);
      z = random(7);
      b = font[ch][x];
      if (z<=3) {
        if (!!(b & (1 << z))){
          cube[x][0][z] = 1; 
          count--;
          render(5);
        }
      }
      else if(!!(b & (1 << z))){
        cube[x][z-3][3] = 1;
        count--;
        render(5);  
      }
      else if (b==0)
        count--;     
    }      
    render(1000);
  }
}

/*
void patternThrowDice(){
 print(1+random(6),1);
 }
 */

void rotate(double theta){
  for (int i; i<3; i++)
