You could use the nice ```times``` operator here:
```groovy
loops.times {
}
```

Also, I just realized that you don't check whether you've used up your total time here (the third condition on line 10 of Luke's Alg 10), which is a correctness issue that needs to be addressed.