Not exact but it sounds familiar. My guess:
Show: It's Always sunny in Philadelphia. Episode: Flowers for Charlie. Description: Charlie gets accepted in an intelligence study. At one point he plays chess with a scientist who is taking notes on his "progress".
It's not a big spoiler if you are paying attention to what's going on in the episode, but Charlie thinks he is actually getting smarter from the pills and does things he thinks are smart but are not. The chess moves he makes are nonsense. The guy actually calls two checkmate moves in a row, which is obviously not possible if the first one was indeed a checkmate.