<P> "The Goat" is the 17th episode in the third season of the television series How I Met Your Mother and 61st overall . It originally aired on April 28, 2008 . </P> <P> The episode begins with the aftermath of the events of "Sandcastles in the Sand": Barney and Robin are in bed together after having sex and she proposes to pretend it never happened . Barney agrees but feels quite awkward and uncomfortable around Ted at MacLaren's later in the day . Hoping to find an excuse for his and Robin's actions, Barney seeks out Marshall to help him find a loophole in the Bro Code, a book listing the rules and philosophies of Barney's life as a "bro". Allegedly written by Barnabas Stinson in the 18th century when Benjamin Franklin and George Washington were too busy to write it themselves, the Bro Code proves to be a very tight document that Ted has followed flawlessly and Barney fails in finding a loophole . When Marshall's nervous behavior reveals to Robin that Barney told him, she tells him that Ted is never finding out . That night, when Barney picks up Ted in a limo, he attempts to give Ted an ultimate 30th birthday by flying him to Las Vegas, which includes staying at the Bellagio, steaks at Boa, and a boxing match between Floyd Mayweather and a grizzly bear . Ted reveals that he knows Barney and Robin had sex together, because Robin told him right after she warned Marshall . Ted, at first, seems calm, and Barney is relieved, but Ted screams at him, angrily declares they're no longer friends, and hails a cab to take him home . Barney then sadly sits in the limo alone all night . </P> <P> Meanwhile, Lily rescues a goat named Missy when a farmer (Farmer Frank, played by Alan Fudge) brings it to her kindergarten class and horrifies her students by going into great detail about what will happen to Missy when she visits the butcher . Lily plans to give the goat away to animal control, but becomes attached to the goat while waiting for Ted to arrive at his birthday party . Older Ted reveals at the end of the episode, after hinting at the destruction the goat would do, that he had the story wrong: Everything involving the goat actually takes place during his 31st birthday, at which point--Older Ted also reveals--Robin is living in the apartment . </P> <Table> <Tr> <Td> </Td> <Td> This section needs expansion . You can help by adding to it . (April 2010) </Td> </Tr> </Table>

In what episode do barney and robin first kiss