I read a lot of questions about how to solve the maze, and I am familiar with the use of recursion in programming. My case is a little different:
I am trying to develop a machine (in Java) to solve a 2D arena with a single entry point, which can be anywhere on the map, and not just on the edge. The goal is not to find a way out (there is none. The entry point is the exit). The mission is to go to all places and look for collectibles, avoiding obstacles.
Imagine this is a digger in a mine. Darkly, you can see 2,3,4 tiles, and what you can see on this range is only collectibles because they flicker. Neither obstacles nor the edges of the map can be โvisibleโ until the excavator tries them and can move. This means that we do not know the full size and shape of the map. Sometimes it is a series of long thin tunnels, sometimes it is a set of large rooms (30x100 blocks) or a combination of both.
I tried a simple solution to solve a maze with recursion in a room-like map with a half-empty room (without obstacles and without collectibles). Starting from this part of the room, the digger travels dozens of times to these empty blocks back and forth until he finally plays out all possible paths and finally reaches the other end of the room.
Obviously, I need a different approach for such maps, while this simple maze solver is great (well, almost) for long tunnels.
For those of you who have come to this, here is a list of additional conditions and features:
- While most collectibles, when they are โdug upโ, disappear and give way, some turn into an obstacle and cannot be transferred.
- There is a gate around the map leading to another map. Imagine this is an elevator and floors.
- There are levers that open doors, keys gather, stones move to open a path or be placed in specific places to unlock areas, etc.
Well, quite an amazing case, and, of course, my excavator will just do simple tasks (1. and 2. are easy to change, and 3. for Isaac Asimov)
, , , :
, , "" , ?