How I Met Your Mother: The Broken Code

"The Broken Code" is the fourth episode of season ninth of the American comedy series How I Met Your Mother and the 160th episode of the series overall. It is the first installment of a two-part season finale and originally aired on CBS on Monday, October 7th, 2013. In this episode, Barney Stinson and Marshall Eriksen go to a casino in Atlantic City and Marshall gets extremely drunk. Barney rides a motorcyle across the casino floor, earning himself the attention of the casino's security staff. Back in New York, Lily begins to go into labor and forces Ted and Robin to tell her stories to take her mind off it. They eventually take Lily to the hospital, but can Marshall get a ride back to New York in time to witness the birth of his son?