Thanks, Richard. Attempt number as a param would definitely help :-)
"I really do worry about the complexity of the existing authoring UI"
As far as I understand, when you submit a code (click on "check" button) the result shows up. I didn't see a way to pass the current state such as the current attempt number. I didn't see it in twig parameters. How do you understand the current attempt number?
The current state is part of the Twig QUESTION variable, specifically QUESTION.stepinfo. See here for the documentation.
To make effective use of this information you really need to be using a combinator template grader. Then, if the student's current submission fails and the student has already made a certain number of tries you can add hints or the sample answer after the result table. If you're not using a combinator template grader then you can only provide hints and feedback within the result table itself and without knowing if the current submission has succeeded or failed. That's rather clumsy.
See this forum discussion for more on this subject, including a very quick prototype of a question that serves up a hint (which may even be the question author's answer) after a number of failed submissions.
Yes, you're right. I checked the documentation last year but somehow didn't see it.
That's why instead of number of checks, we had a hint system that is parametrized on the received score.
Thanks for the help!