In Star Trek II: The no win scenario that all starfleet
commanders faced upon leaving
the academy. There is no way to beat the simulation to see how a commander can cope with such a scenario.
However,
Captain Kirk got a medal of ingenuity from Starfleet by beating the simulation by reprogramming the computer to have a situation in which he could win.
It's the only known solution and noone has been able to reproduce it but Kirk.