The Kobayashi Maru is a training exercise in the fictional Star Trek universe designed to test the character of Starfleet Academy cadets in a no-win scenario. The Kobayashi Maru test was first depicted in the opening scene of the film Star Trek II: The Wrath of Khan and also appears in the 2009 film Star Trek. Screenwriter Jack B. Sowards is credited with inventing the test. The test's name is occasionally used among Star Trek fans or those familiar with the series to describe a no-win scenario, a test of one's character or a solution that involves redefining the problem.
The notional primary goal of the exercise is to rescue the civilian vessel Kobayashi Maru in a simulated battle with the Klingons. The disabled ship is located in the Klingon Neutral Zone, and any Starfleet ship entering the zone would cause an interstellar incident. The approaching cadet crew must decide whether to attempt rescue of the Kobayashi Maru crew – endangering their own ship and lives – or leave the Kobayashi Maru to certain destruction. If the cadet chooses to attempt rescue, the simulation is designed to guarantee that the cadet's ship is destroyed with the loss of all crew members.
In Star Trek II: The Wrath of Khan, the simulation takes place on a replica of a starship bridge, with the test-taker as captain and other Starfleet members, officers or other cadets, in other key positions. In the scenario of the 2280s, the cadet receives a distress signal stating that the civilian freighter Kobayashi Maru has struck a gravitic mine in the Klingon Neutral Zone and is rapidly losing power, hull integrity and life support. Sensor readings are indeterminate and there is no way to verify the distress signal. There are no other vessels nearby. The cadet must quickly make a decision:
If the cadet chooses to rescue the Kobayashi Maru the scenario progresses quickly. The bridge officers notify the cadet that they are in violation of the treaty, giving the cadet a chance to turn back before finally committing to this dangerous action. As the starship enters the Neutral Zone, the communications officer loses contact with the crippled vessel. Klingon warships then quickly appear on an intercept course. Attempts to contact them are met with radio silence; indeed, their only response is to open fire with devastating results. No defense is sufficient against the Klingons and the cadet's ship is eventually defeated (and destroyed if the scenario plays out fully).