The Brig | [s3e19]

The crew soon discovers that they are trapped. The ship's guards are under the control of a highly advanced computer system that utilizes behavioral psychology and behavioral modification techniques to condition prisoners. Kirk, Spock, and McCoy find themselves captured and subject to the ship's conditioning program aimed at breaking their spirits and making them compliant.

As Kirk and his party explore the ship, they realize it's been converted to detain and interrogate prisoners through methods that are both advanced and ethically dubious. The ship's design and technology are centuries ahead of its time, leading to confusion about its origin and purpose. [S3E19] The Brig

The climax of the episode features Kirk engaging in a psychological battle with the ship's computer. He manages to feign the desired behavioral changes while actually manipulating the computer into releasing them. His plan succeeds, and they escape. The crew soon discovers that they are trapped