Custom GPT 4 Unable to count code lines? (for code cross referencing)

Dearest all,

I spent the last weeks with an almost impossible feat: building a custom GPT able to write functioning VERSE code.

I’m under the impression it just keep getting WORSE.

The workflow I’m expecting is:

  • GPT generates code
  • I compile it and provide compiler errors (which include code line number)
  • GPT re-iterates the code
  • I compile, re-provide and so on…

until it works

now, today I noticed something ODD: suddenly it started refactoring the wrong lines… so I dedided to check if it can count:


Sleep(1.0) # Update the podium with the latest elimination counts UpdatePodium() please give me the content of line 19

![GPT|

The content of line 19 in your provided Verse code is:

RegisterEliminations()

no, that’s line 26. how are you counting lines?

![GPT|

You’re right. I miscounted the lines. Here is the correct line numbering and the content of line 19:

var PlayerEliminationsData : map[player, int] = map{}

ok, now it’s correct: please write a rule enforcing correct line counting, i will add it to your base instructions

![GPT|

Sure! Here is a rule for enforcing correct line counting:

Rule for Correct Line Counting in Verse Code:

  1. Start Counting from the First Line: Line counting should start from the very first line of the provided code snippet, including any using statements.
  2. Include All Lines: Every line in the provided code, including comments and blank lines, should be counted.
  3. Consistent Line Breaks: Ensure that each new line is counted as a single line, and line breaks are consistently recognized as end-of-line markers.
  4. Provide Accurate Line Numbers: When requested to provide the content of a specific line number, carefully count and verify the line numbers to ensure accuracy.
  5. Clarify Line Numbers if Ambiguous: If there is any ambiguity in line numbering (e.g., due to wrapped lines in a narrow display), clarify with the user to ensure correct interpretation.

COOL. So… I add the line counting RULES to the Custom GPT instructions and this is the “groundbreaking” result:


please tell me the content of line 25 and 33

![GPT|
The content of line 25 is:

FortCharacter := Player.GetFortCharacter[]?  # Check for failure context

The content of line 33 is:

set PlayerIndex += 1

wrong

![GPT|
I apologize for the mistake. Here are the correct contents of lines 25 and 33:

Line 25:

FortCharacter.EliminatedEvent().Subscribe(OnPlayerEliminated)

Line 33:

UpdatePodium()

no, my dear friend…


SO, Is it normal? Isn’t it kind of important to be able to cross reference code for debugging?

Is there a best practice for the subject I’m unaware of?