Storing a joystick input sequence

So, I was trying to do a KONAMI sequence on a joystick to turn on a green led.
For those unaware, the sequence is UP UP DOWN DOWN LEFT RIGHT LEFT RIGHT.
I figured that I needed to store the sequence in an array, then compare it with the sequence of the input. But I don't know how. For now, I wrote this:

'

const int JX = A0;
const int JY = A1;
const int JB = 2;

const int RED = 4;
const int GREEN = 5;

int POS;
int Pos16;
int Pos15;
int Pos14;
int Pos13;
int Pos12;
int Pos11;
int Pos10;
int Pos9;
int Pos8;
int Pos7;
int Pos6;
int Pos5;
int Pos4;
int Pos3;
int Pos2;
int Pos1;
int Combo;
int PrevPos;
int FinPos;
int StoredPos;

void setup() {
 Serial.begin(9600);
 pinMode(JB, INPUT);
 pinMode(RED, OUTPUT);
 pinMode(GREEN, OUTPUT);

}

void loop() { 

 int x = analogRead(JX);
 int y = analogRead(JY);
 int b = digitalRead(JB);

  PrevPos=POS;

if(x == 1023 && y != 0 && y != 1023){ 
  POS = 1; 
} else if(x == 0 && y != 0 && y != 1023){ 
  POS = 2; 
} else if(y == 0 && x != 0 && x != 1023){ 
  POS = 3; 
} else if(y == 1023 && x != 0 && x != 1023){ 
  POS = 4; 
} else {
  POS = 0;
}

if(PrevPos != POS){
  FinPos = PrevPos;
} else {
  FinPos = 0;
}

 Serial.println("X: " + String(x)+",\tY: " + String(y)+",\tP: " + String(b)+",\tPOS: " + String(POS)+",\tPREVPOS:"+ String(PrevPos)+",\tFINPOS:"+ String(FinPos));
 delay(100);

}

How do I store the FinPos in an array?

First declare the array

int finPos[16];    //an array of 16 integers

Declare a variable to be used as an index to the array

byte currentIndex = 0;  //start the index at zero

Each time you want to save a value

finPos[currentIndex] = currentValue;  //save the current value to the current level in the array
currentIndex++;  //move to next level of the array

When the value of currentIndex equals 16 then 16 values have been saved

... equals 15 (0...15) then 16 values...

UP UP DOWN DOWN LEFT RIGHT LEFT RIGHT B A SELECT

It depends where you test the value. To me the obvious place is immediately after incrementing it, hence

I agree that I could have been more specific, but my aim was to get @spacecipolla to think for themselves instead of providing a potted answer