There is a terraced structure with N floors (here, for example 4 floors). Each floor has 4 cells.
Write the recursive function that describes the number of all the possible paths from the left bottom cell to the top right cell. We can go up, down, right but not left and we can't visit in the same cell again. Use only one variable.

You can make a total of $9$ moves to get to the right upper cell in the grid starting from the lower left cell. At any given moment during your moves, The number of right moves made so far is always larger than or equals to the number of up moves made so far. Also, at any given time, the difference between number of right moves and the number of up moves seen so far should not be greater than $3$.
We can translate those condition into restriction on formulas, so we first give definition of some variables.
We let $r$ denote the number of possible right moves that you can still make so far, let $l$ be the number of possible left moves you can still make so far and let $t$ be the number of moves you can still make. Then $r+l=3$(because each time you make a right move, the number of right moves you can still make decreases by $1$ and the number of up moves that you can make increases by $1$) and $t=9$ initially.
let $H(r,l,t)$ be the number of ways to finish all your moves where you can still make $r$ right moves, $l$ left moves and $t$ more moves. Then $H(r,l,t)=1+H(r-1,l+1,t-1)+H(r+1,l-1,t-1)$ The base cases is: $H(r,l,t)=0$ if $(t=0) \vee (r<0) \vee (l<0)$ and you want to solve $H(3,0,9)$.
Hope this is a good recursion.