it is:
(async function(oracle, punch, delay) {
async function sleep(ms) {
return new Promise((resolve, _) => {
setTimeout(resolve, ms)
})
}
for (let i = 0; i < 100; i++) {
const state = oracle._state
const block = oracle.predictNextPunch()
oracle._state = state
punch(block === 'L' ? 'R' : 'L')
await sleep(delay)
}
})(oracle, punch, 150)