I almost wrote a snake game, but I still can’t get one of the main ideas. I would like for random walls to appear on the map during the game, as it happens in google snake game in wall mode. Here is the link to game.
My question is only about the idea of the algorithm and it's disconnected from a specific programming language.
The problem is that absolutely random walls could create “unreachable” places in the level, such as enclosed spaces, where the snake could not get theoretically. So how to check such "unreachable" places on a level and not create incorrect walls?
PS: Sorry for my poor English.