LLMs don't know how to write code in Kotlin?

I spent a whole week on this:

  1. Trying to write and debug the algorithm in Kotlin on an Android device.
  2. After a couple of days, I gave up and—relatively quickly—rewrote the algorithm in Python.
  3. Spent another 2–3 days attempting to port it back to Kotlin.
  4. And in the end, I spent 2 hours to shoving the working Python code into the Android app. And it finally worked.

Now I’ve got a failed_attempts.md - log of failed change that’s over 260 lines long and a wealth of new knowledge on how to Agent-coding. Kotlin code didn’t run even when the LLMs swore the Kotlin was “identical” to the Python.

I didn’t use o3 or Opus, or MAX because they’re too expensive, but Gemini 2.5 Pro, Claude 4 Sonnet, o4-mini and gpt-4.1 which I drifted between couldn’t get it right, either.