I am creating a maze type puzzle game where there is a grid and the user can create their own maze but I need help in writing an algorithm which finds the following things:
- How many dead ends are there. (It should return 4 tunnels which are marked red)
- How many of those dead ends don't lead to the exit. (It should return 3 tunnels as only 1 dead end leads to the END point)
- Which dead ends lead to the end. (*3rd dead end only)
I am new to writing algorithms so I haven't written code for this yet. How can I identify dead ends, and which ones don't lead to the exit?

4, does that still count as a deadend or as a loop? Do you allow loops at all? \$\endgroup\$