Simon says with prize wheel

Hello people 8)

Im doing my first arduino project in a school assignment.

Equipment:
Arduino Uno board
Two servos
Standard pushbuttons
LED's

Im trying to make a simon says game with three led's, without sound, but with a pricewheel and a hatch controlled by two servos.
The code i have so far is Robert Spanns version, stripped for sound(at least some) and ive just added in some definitions.

/*Simon Says game. Now with sound effects. 

Originaly made by Robert Spann
Code trimmed and sound effects added by digimike

Buttons are to be set on there designated pins without pull down resistors
and connected to ground rather then +5. 
*/
#include <Servo.h>
Servo servoWheel; // Defining the servo-wheel
Servo servoHatch; // Defining the servo-hatch

boolean button[] = {2, 3, 4}; //The three button input pins
boolean ledpin[] = {8, 9, 10};  // LED pins

int cashOutButton = 5; // Button for opening hatch, resets game
int carryOnButton = 6; // Button if you want to play on 

int turn = 0;  // turn counter
int buttonstate = 0;  // button state checker
int randomArray[100]; //Intentionally long to store up to 100 inputs (doubtful anyone will get this far)
int inputArray[100];  


void setup() 
{
  // servo on digital pin 11
  servoWheel.attach(11);
  servoWheel.write (0);
 // servo 2 on digital pin 10
  servoHatch.attach(10);
  servoHatch.write (0); 
  Serial.begin(9600);

  for(int x=0; x<4; x++)  // LED pins are outputs
  {
    pinMode(ledpin[x], OUTPUT);
  }
  
  for(int x=0; x<4; x++) 
  {
    pinMode(button[x], INPUT);  // button pins are inputs
    digitalWrite(button[x], HIGH);  // enable internal pullup; buttons start in high position; logic reversed
  }

  randomSeed(analogRead(0)); //Added to generate "more randomness" with the randomArray for the output function
  for (int thisNote = 0; thisNote < 13; thisNote ++) {
     
     if (thisNote==0 || thisNote==2 || thisNote==4 || thisNote== 6)
     {
       digitalWrite(ledpin[0], HIGH);
     }
     if (thisNote==1 || thisNote==3 || thisNote==5 || thisNote== 7 || thisNote==9 || thisNote==11)
     {
       digitalWrite(ledpin[1], HIGH);
     }
     if (thisNote==8 || thisNote==12)
     {
       digitalWrite(ledpin[2], HIGH);
     }  
     if (thisNote==10)
     {   
       digitalWrite(ledpin[3], HIGH);
     }

     digitalWrite(ledpin[0], LOW);
     digitalWrite(ledpin[1], LOW);
     digitalWrite(ledpin[2], LOW);
     digitalWrite(ledpin[3], LOW);
     delay(25);
    }
  delay(1000);
}
 
void loop() 
{   
  for (int y=0; y<=99; y++)
  {
    //function for generating the array to be matched by the player
    digitalWrite(ledpin[0], HIGH);
    digitalWrite(ledpin[1], HIGH);
    digitalWrite(ledpin[2], HIGH);
    digitalWrite(ledpin[3], HIGH);
  
    for (int thisNote = 0; thisNote < 6; thisNote ++) {

     delay(25);
    }
    
    digitalWrite(ledpin[0], LOW);
    digitalWrite(ledpin[1], LOW);
    digitalWrite(ledpin[2], LOW);
    digitalWrite(ledpin[3], LOW);
    delay(1000);
  
    for (int y=turn; y <= turn; y++)
    { //Limited by the turn variable
      Serial.println(""); //Some serial output to follow along
      Serial.print("Turn: ");
      Serial.print(y);
      Serial.println("");
      randomArray[y] = random(1, 5); //Assigning a random number (1-4) to the randomArray[y], y being the turn count
      for (int x=0; x <= turn; x++)
      {
        Serial.print(randomArray[x]);
      
        for(int y=0; y<4; y++)
        {
      
          if (randomArray[x] == 1 && ledpin[y] == 8) 
          {  //if statements to display the stored values in the array
            digitalWrite(ledpin[y], HIGH);
            delay(400);
            digitalWrite(ledpin[y], LOW);
            delay(100);
          }

          if (randomArray[x] == 2 && ledpin[y] == 9) 
          {
            digitalWrite(ledpin[y], HIGH);
            delay(400);
            digitalWrite(ledpin[y], LOW);
            delay(100);
          }
  
          if (randomArray[x] == 3 && ledpin[y] == 10) 
          {
            digitalWrite(ledpin[y], HIGH);
            delay(400);
            digitalWrite(ledpin[y], LOW);
            delay(100);
          }

          if (randomArray[x] == 4 && ledpin[y] == 11) 
          {
            digitalWrite(ledpin[y], HIGH);
            delay(400);
            digitalWrite(ledpin[y], LOW);
            delay(100);
          }
        }
      }
    }
    input();
  }
}
 
 
 
void input() { //Function for allowing user input and checking input against the generated array

  for (int x=0; x <= turn;)
  { //Statement controlled by turn count

    for(int y=0; y<4; y++)
    {
      
      buttonstate = digitalRead(button[y]);
    
      if (buttonstate == LOW && button[y] == 2)
      { //Checking for button push
        digitalWrite(ledpin[0], HIGH);
        delay(200);
        digitalWrite(ledpin[0], LOW);
        inputArray[x] = 1;
        delay(250);
        Serial.print(" ");
        Serial.print(1);
        if (inputArray[x] != randomArray[x]) { //Checks value input by user and checks it against
          fail();                              //the value in the same spot on the generated array
        }                                      //The fail function is called if it does not match
        x++;
      }
       if (buttonstate == LOW && button[y] == 3)
      {
        digitalWrite(ledpin[1], HIGH);
        delay(200);
        digitalWrite(ledpin[1], LOW);
        inputArray[x] = 2;
        delay(250);
        Serial.print(" ");
        Serial.print(2);
        if (inputArray[x] != randomArray[x]) {
          fail();
        }
        x++;
      }

      if (buttonstate == LOW && button[y] == 4)
      {
        digitalWrite(ledpin[2], HIGH);
        delay(200);
        digitalWrite(ledpin[2], LOW);
        inputArray[x] = 3;
        delay(250);
        Serial.print(" ");
        Serial.print(3);
        if (inputArray[x] != randomArray[x]) {
          fail();
        }
        x++;
      }

      if (buttonstate == LOW && button[y] == 5)
      {
        digitalWrite(ledpin[3], HIGH);
        delay(200);
        digitalWrite(ledpin[3], LOW);
        inputArray[x] = 4;
        delay(250);
        Serial.print(" ");
        Serial.print(4);
        if (inputArray[x] != randomArray[x]) 
        {
          fail();
        }
        x++;
      }
    }
  }
  delay(500);
  turn++; //Increments the turn count, also the last action before starting the output function over again
}

void fail() { //Function used if the player fails to match the sequence
 
  for (int y=0; y<=2; y++)
  { //Flashes lights for failure
    
    digitalWrite(ledpin[0], HIGH);
    digitalWrite(ledpin[1], HIGH);
    digitalWrite(ledpin[2], HIGH);
    digitalWrite(ledpin[3], HIGH);
    delay(200);
    digitalWrite(ledpin[0], LOW);
    digitalWrite(ledpin[1], LOW);
    digitalWrite(ledpin[2], LOW);
    digitalWrite(ledpin[3], LOW);
    delay(200);
  }
  delay(500);
  turn = -1; //Resets turn value so the game starts over without need for a reset button
}

I want a servoWheel to spin 90 degrees automaticaly when you clear lvl 10, and another 90 degrees when clearing lvl 20. And if you loose it should spin back to 0 degrees.

I also need a cashout button that activates(indicated by a led that blinks on off on off) at lvl 10/20 which will open a ServoHatch if you want to cashout . There are two prizes and I want players to be able to either take the first prize or play on, i.e. the cashout button must deactivate if you play on.

I really need help with programming how to add the prizewheel and hatch/cashout-button functions to the code. I cant see if the game, as it is, counts your progression, which I guess should be helpful for the servo functions.
Additonally do I need to strip away any code in the game to make work with only three led's?

Any urgent help is much appreciated!

Prototype:

You need to post a schematic. Normally a servo will not rotate 180 degrees, are you sure yours will.
What is the servo doing? That photograph just shows a cardboard arm on a servo.

Is this understandable?

Both servos are able do to 180 degrees. One is for the prizewheel and the other opens the hatch at 60 degrees.

Heres a quick video test.

I want a servoWheel to spin 90 degrees automaticaly when you clear lvl 10,

So is there a variable in the code that has the level in it? You said:-

I cant see if the game, as it is, counts your progression,

I can't see anything either. So put something in just after you decide the sequence has been matched that increments a variable.

Just after the increment check to see if it is equal to 10 and if so rotate the servo.
Similarly when it reaches 20.

At the same time it reaches 10 set a booleian variable called something like cashOutEnable to true, and check against this when the button is pressed.

I am not sure what sort of help you are wanting but it seems like you don't actually understand the code you have. We help you with code here but we will not write it for you. You will make a good start by understanding what you have got. To me it seems like the sequence is only four states long but that is just with a quick look.

Yeah you are spot on, I don't really understand the original game code(first time exploring arduino). I guess I was looking for a quick fix from others that have experimented with the game.
I haven't really worked with increments yet, so not sure what to start with i'm afraid.

If the game is confusing, it's about matching a random led color combination, starting with 1 blink, then 2, then 3 and so on.

How would i go about checking if the sequence is matched? I know the game itself blinks one time on all led's if sequence is matched(it also blinks three times on all led's if its no match) So i probably need a code that knows if its matched 10/20 times.

Overall I think i know what you're suggesting but its still somewhat greek to me.

There is a Simon Says game in the Arduino playground that you can take a look at. But since this is a project for school, Im not going to tell you exactly where it is, so you will need to search for it.

I will tell you its called Simple Simon Says game.

There should be plenty of comments telling you what does what, so you should be able to learn from it.