Sheldon develops a friendship algorithm based on a children's book and utilizes it in an attempt to improve his friendship with Kripke. When trying to find an activity that is mutually interesting for both of them, Sheldon runs into an infinite loop in his algorithm. Howard modifies the algorithm to include a loop counter and an escape.
In this clip, Charlie suggests using an evolutionary algorithm to search for abnormal behavior after a murder occurs in a video game with a real-life component. Evolutionary algorithms imitate the biological process of natural selection to find optimal solutions.