There are many references to poker in Castle episodes. Most often poker provides Richard Castle with a forum to work out his toughest cases by finding out from his writer colleagues who they would make the murderer if they were writing a story based on the case. They have also unknowingly helped him come to grips with his feelings for Kate Beckett.
In the series pilot (Flowers For Your Grave), Castle references playing poker with authors James Patterson and Stephen J. Cannell while being interrogated by Detective Beckett and later in the episode we see him playing Poker with them both.Ghosts), Castle invites Detectives Kate Beckett, Kevin Ryan, and Javier Esposito, and Captain Roy Montgomery to play with him and his mother Martha Rodgers. Even though he knows he has an unbeatable hand, he lets Beckett win, a fact that she eventually discovers. Later in the episode, he invites Beckett over to his apartment for another game, this time with the New York City Mayor, Judge Markway, a city judge, and Captain Montgomery. Bekcett has the unbeatable hand this time, and lets Castle win, a fact that he also discovers. At the end of the episode, Castle challenges Beckett to a final game.
In the original unaired pilot while Beckett is interrogating Castle he mentions playing poker with "Patterson, Grafton, King". This was also in one of the early sneak peeks for the episode but was changed in the scene that aired so it matched with the authors actually appearing in the poker playing scene later in the episode.