Error in count board path code

I am using the same code as given in the video,yet the intellij is showing stackoverflow error,same happen to print Boardpath code

try to verify your code with this: