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.
After Mr.Kindle discloses to his class that also has a child but the child lives with his mother, the topic of divorce comes up in the kindergarten classroom. The children talk about the how they interpret divorce and the reasons why their teacher is divorced.