I'm struggling to come up with an equation that can determine the number of shortest paths for a King between two points on a chess board. I came across Getting the shortest paths for chess pieces on n*m board, which uses a BFS to find the answer. However, I don't really need to know the path and I was hoping to come up with a general equation. I also noticed this was similar to some questions asked about finding Lattice Paths, however in this case, the path may contain horizontal movement.
I started with a small case, with the starting point of A4 and a target point of C4. It's quick to see there are only three shortest paths between the two points (A4-B5-C4, A4-B4-C4, and A4-B3-C4).
Then I expanded, starting out at A4 and targeting D4 and came up with seven possible shortest paths (A4-B5-C5-D4, A4-B5-C4-D4, A4-B4-C5-D4, A4-B4-C4-D4, A4-B3-C3-D4, A4-B3-C4-D4, A4-B4-C3-D4).
At this point it seemed like coming up with an equation wouldn't too terribly hard, but my math skills fail me here. Starting with the first case (A4-C4), from the starting location, A4, it seems there are three possible choices. Then from any of those spaces, there is only one possible choice, C4.
For the second case (A4-D4), from the start there are again only three possible choices. Then from those three locations, two only have two choices (B3 & C5) and one has three choices (C4). Then, from all of those resulting locations, there is only once choice, D4.
I feel like I'm close, but cannot solidify an equation. Any help would be greatly appreciated.