How does Bitcoin Gold difficulty adjustment work?
It's just a simple moving average with a window of 30 blocks:
next_D = sum(past 30 D) / sum(past 30 solvetimes) * 600

This isn't exactly what it's doing, but it's darn close.