The 'knight on an infinite chessboard' puzzle: efficient simulation in R

1 · David Robinson · Dec. 10, 2018, 4 p.m.
Previously in this series: The “lost boarding pass” puzzle The “deadly board game” puzzle I’ve recently been enjoying The Riddler: Fantastic Puzzles from FiveThirtyEight, a wonderful book from 538’s Oliver Roeder. Many of the probability puzzles can be productively solved through Monte Carlo simulations in R. Here’s one that caught my attention: Suppose that a knight makes a “random walk” on an infinite chessboard. Specifically, every turn the knight follows standard chess rules and moves to ...