I saw Wrath of Kahn too, and the idea was that he edited the program or simply "cheated". He then while stranded planetside waiting for Enterprise to rescue him confessed that until that moment he had never truly confronted a no-win scenario.
I imagine . . . I know what I'm talking about.