Adaptive LDR Arduino

I didn't really "study" your code but this
if (current != last)
"never works". Or rather, it's almost always true that two analog readings won't be exactly the same.

You usually have to look for a "close" value or greater or less than, etc.

You probably need some hysteresis. The heater in your house is an example - If heat is set to come-on below 70 degrees (F) it might come-on at 69 degrees. Then it stays on until the temperature hits 71, then shuts-off. Then doesn't some back on again until the temperature drops to 69. (It's not always one degree high or low, but that's the idea of hysteresis. )

If you haven't done so, you can run the code from the Analog Read Serial Example to "see" your light & dark readings so you can choose your thresholds.