c# - Check for closed path in numerical heightmap -


I am working on a game, and I need to check the closed path in the given numerical height map: The server and client use these heightmaps to set the right corrons etc ... Now, when a user runs on "special" tile, then this light ... my problem is: when a user, these tiles The path with empty tiles on the way, the server automatically stops by running on

It should do something like this: - 1:32

I am sure that I have used some maths here or there, But I do not know that ... I could have done it for a "cycle", but it would be too long, and the problem is that every time a user moves to the server ... for your answer Thanks in advance, hope someone can help me

PS: I am using C #

EDIT: When a user runs on a tile, then the server automatically

The problem can be divided into two parts: < When a path is closed, one way to do this is by making a connection between the sequential tile in the path: when you take a step, one of your new neighbors Is visited and you back up your path Can not find on the way between your current neighbors you have closed the path (you can establish additional links to deal with the matter of returning with your path) Which side of your way (left or right) is located in the area with the graph play around it and it should become clear. It is o (1) with each phase

  • Fill in the attached area Once you find a single tile in this area, then again with your neighbors, and then your neighbors, and so on. For field area, it is the worst at the time of O (n) and average o (sqrt (n)) memory, on the basis of geometry (O).

  • Comments