int bell[4];
int code[]={1,1,2,2};
int button1 = 8; 
int button2 = 11;
int led = 2;
int correct, pressed;

void setup(){
  pinMode(led, OUTPUT);      
  pinMode(button1, INPUT);   
  pinMode(button2, INPUT);   
}

void loop() {
  // check the buttons
  pressed=0;
  if (digitalRead(button1) == HIGH) { 
    pressed=1;
  }
  if (digitalRead(button2) == HIGH) { 
    pressed=2;
  }
  if (pressed!=0){
    // debounce
    while ((digitalRead(button1) == HIGH) or (digitalRead(button2) == HIGH)) {
      delay(20);  
    }
    // move 
    for (int t=0;t<3;t++){
      bell[t] = bell[t+1];
    }
    bell[3] = pressed;
    // compare
    correct=0;
    for (int t=0;t<4;t++){
      if (bell[t] == code[t]){
        correct++;
      }
    }
    if (correct==4){
      digitalWrite(led, HIGH);   
      delay(1000);               
      digitalWrite(led, LOW);                  
    }
  }
}
