Problem 60541. Compute the number of squares a knight can reach after n moves
Several Cody problems involve knights from chess. They have asked players to find a knight’s tour in a matrix (CP 96), determine whether points are reachable given the moves of a knight and other pieces (CP 1684), calculate the probability that a knight will remain on a chessboard after a given number of moves (CP 45389), determine the number of moves to reach a destination (CP 45433), find when a knight not allowed to revisit squares will be trapped (CP 54780), and list the squares that a knight can reach after one move (CP 57660).
This problem involves the number of squares on an infinite chessboard that a knight can reach. If the knight starts on the pink square below, then it can reach the eight squares marked “1” after one move and the 33 squares marked “2” after two moves.
Write a function to compute the number of squares that a knight can reach after n moves.
Solution Stats
Solution Comments
Show commentsProblem Recent Solvers6
Suggested Problems
-
Is my wife right? Now with even more wrong husband
1322 Solvers
-
Arrange vector in ascending order
771 Solvers
-
Implement a bubble sort technique and output the number of swaps required
281 Solvers
-
Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
374 Solvers
-
80 Solvers
More from this Author273
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!