Dynamic Programming21 sections · 916 units
Open in Course

Knight Probability - The Setup

Understanding the grid

The knight's position matters. A knight in the center has all 8 moves available. A knight in a corner might have only 2 legal moves (the rest go off-board). The number of remaining moves matters too.

With k=0k=0 moves left, if you're on the board, probability is 11. With k=1k=1, it depends on how many of your 8 moves stay on-board. State: (row,col,moves_left)(row, col, moves\_left). Value: probability of staying on-board from this state to the end.