How can I record a push button sequence and store it in an array
You can create an array like this, make it global to easy access it:

int states[10];


And the current index:

int index_state = 0;


And initialize the array (in setup):

for (int n = 0; n &lt; 10; n++)
{
    states[n] = 0; // Unpressed
}


When a new button press should be stored:

states[index_state] = state;


And add one to the index state, if 10 is reached, start over (this means the last 10 are stored).

index_state = (index_state + 1) % 10;


And to check the states you just iterate from index_state.

Hope this helps you get going.

Note this is called a ring buffer.