function autoPlayLoop() // Iterate through all currently active notes in the song for (let note in game.notes) // Check if the note is close enough to the strum line if (note.isWithinHitWindow && !note.hasBeenHit) // Simulate the key press corresponding to the note direction simulateKeyPress(note.direction); note.hasBeenHit = true;