# Paths in a square grid with diagonal moves allowed

How many ways are there for a piece in the bottom-left corner of a 5x5 chessboard to move to the square marked $$B$$ in the figure below if the piece may only move up, right, and diagonally to the upper-right one square at a time?

Attempt: I imagined the board as closed rooms and in each room I placed a door connecting each two rooms. I counted the doors, eliminated the repetitions and gave 75. As I could repeat the path in a perpendicular direction from the first room I added another 75. I Got $$76+76=152$$

I would like to know the flaw in my reasoning... the answer to the question is 321

You can achieve the top right with $$0$$ diagonal move and $$8$$ moves, $$4$$ right, and $$4$$ up moves in any configuration, or $$1$$ diagonal moves and $$6$$ moves, $$3$$ right, and $$3$$ up moves in any configuration, etc.
$${8 \choose 4} + {7 \choose 1}{6 \choose 3 }+ {6 \choose 2} {4 \choose 2}+ {5\choose 3}{2 \choose 1 }+ { 4 \choose 4} = 321$$
• If you make three diagonal moves, there are a total of five moves, of which three are diagonal, one is up, and one is to the right. Therefore, the fourth term in your sum should be $\binom{5}{3}\binom{2}{1}$ since you must select which three of the five moves are diagonal moves and which of the other two moves is to the right. Commented Oct 15, 2021 at 22:48