Laser Maze with laser diodes, photo resistors and a relay

I want to switch an relay instead of a servo. Need some help wth the arduino code:

So, what is the problem? If you know what value to write to a servo, you know whether that value is above, or below, the threshold needed to turn the relay on or off.