Help with Laser Maze for Arduion. Thanks !!!

Hello all I am hoping to create a laser maze. I am trying to get the lasers to hit a photoresistor and the arduino read the photoresistors. When the photoresistors are broken by someone blocking the path I want it to push to keep count. For the first time I want it to push to a relay, the second time push to a different relay and finally the thrid time push to a final relay. The inital code was written to push to a servo; however, I do not wish to do that. Hopefully this is clear enough to understand what I am wanting to do.

Thanks In Advance.

#include <Servo.h> 

// servo will be used to flip a switch on the red beacon light 
Servo myservo;  

// constants to set up pins  
int mySensors[] = {A0, A1, A2, A3, A4, A5};    // analog pins with photoresistors cells to detect laser beam
const int numSensors = 3;   // total number of photoresistors cells used ###

// variables to handle analog values from CDS cells
int curValue;               // stores the value of the photoresistor cell that is currently being read
int prevValue[numSensors];  // stores the previous value of each photoresistor cell
int baseValue[numSensors];  // stores a baseline value for each photoresistor cell when the laser beam is not broken
int shouldAlarm[numSensors];// flag to decide if alarm signal should be sent
int sensitivity = 35;       // an offset from the baseValue to determine if laser beam is broken ###
int sendAlarm = 0;          // determines if we should send the alarm signal to the COM port


// variables to control red beacon light
int alarmLength = 3000; // how long red light should remain on in milliseconds - synch with mp3 played by processing
unsigned long alarmTime;// time alarm was activated
int onPos = 50;          // on position for servo   
int offPos = 110;        // off position for servo 

void setup() {
  // initialize the serial communication to PC
  Serial.begin(9600);

  // attach the servo to pin 9
  myservo.attach(9); 
  myservo.write(offPos);
  
  // set all of the photoresistor cell analog pins as inputs
  for (int thisSensor = 0; thisSensor < numSensors; thisSensor++)  {
    pinMode(mySensors[thisSensor], INPUT);     
  }
  


  calibrate();
}

void loop() 
  // check each photoresistor cell to see if the laser beam is broken
  for (int thisSensor = 0; thisSensor < numSensors; thisSensor++)  {
    curValue = analogRead(mySensors[thisSensor]);
    
   // A broken beam is detected if the current sensor value and
   // the previous value are both less than the base value
   // minus the sensitivity. 
    if (curValue < (baseValue[thisSensor] - sensitivity) && prevValue[thisSensor] < (baseValue[thisSensor] - sensitivity) && shouldAlarm[thisSensor] == 1) {
      // laser beam has been broken, alarm should be sent
      Serial.println("alarm");
      shouldAlarm[thisSensor] = 0;
      // activate servo to turn on red beacon light
      myservo.write(onPos);
      delay(20);
      alarmTime = millis();
    }
    // laser beam not currently broken, so reset the alarm flag
    else if (curValue > (baseValue[thisSensor] - sensitivity) && prevValue[thisSensor] > (baseValue[thisSensor] - sensitivity)) {
      shouldAlarm[thisSensor] = 1;
    }
    prevValue[thisSensor] = curValue;  // update the previous value
  }

  // deactivate the servo if it has been more than alarmLength
  if (millis() - alarmTime > alarmLength) {
    myservo.write(offPos);
    delay(20);
  }
}

void calibrate() {
  // for each photoresistors cell, average three readings together to 
  // calculate base value when laser beam is not broken
  for (int thisSensor = 0; thisSensor < numSensors; thisSensor++)  {
    baseValue[thisSensor] = analogRead(mySensors[thisSensor]);    // first reading
    delay(20);
    baseValue[thisSensor] += analogRead(mySensors[thisSensor]);   // plus second reading
    delay(20);
    baseValue[thisSensor] += analogRead(mySensors[thisSensor]);   // plus third reading
    baseValue[thisSensor] /= 3;                                   // divided by 3 to find average
    
//    Serial.println(thisSensor);
//    Serial.println(baseValue[thisSensor]);
  }
}

I don't know what you want at all. I don't know what push means in this context and I don't know your wiring. Post in Gigs and Collaborations if you want code written for you, although part of the fun with Arduino is that you get to learn and do these things yourself.

Im sorry for being confusing. Really I am just trying to figure out how to create a loop count for Arduino. To help illustrate I will create a dummy variable I. initially I = 0 every time the photoresistor does not detect the laser it counts once increasing the value I. I also want the Arduino to activate a different relay for I. For example when I = 0 nothing happens. When I = 1 it activates relay 1. When I =2 it activates relay 2. When I =3 it activates relay 3. Im not quite sure how to code the counting aspect.

I suspect that you know how to add 1 and I suspect that you already know about I++.
What you may not know is that the loop() function may execute thousands of times per second, so a count of 2 or 3 is unlikely unless you are prepared for this. delay(...) will slow things down but is not a good way to go because it may introduce other problems.

rather that keep track of the previous sensor value as a state, i think you're better offer keeping track of consecutive events where the sensor exceeded it's threshold, a cnt. you can do something after one, a 2nd or a third event. the cnt is reset to zero when a sensor does not exceed a threshold. of course you can ignore event above N or simply limit the cnt to N

but i think you also need to allow some delay between checking for events.