It is fairly common for game generation to fail due to a minor Python syntax error.
We could try to get past this with a control flow like:
- Attempt to generate the game based on the users prompt
- If there's a failure, get the stack trace from the pygame subprocess stdout/stderr
- Invoke the LLM again with system message "The following Python code has an error. Output a single Python code block that fixes the error. Make no other adjustments. Error: ERROR; Code: CODE."
- Replace the existing game in the library with the new game that was generated.
It is fairly common for game generation to fail due to a minor Python syntax error.
We could try to get past this with a control flow like: