搜索给定区域资源的技术/算法
我有一个平坦的区域,节点随机放置在这个平坦的表面上。我需要能够以某种方式(算法)移动、找到节点并继续搜索的技术。我没有表面的整体视图(即我看不到所有内容),只有有限的视图(即任何方向上的 4 个单元格)。理想情况下,这些方法的工作方式应该是高效的。
任何正确方向的观点都将不胜感激。
I have a flat area with nodes randomly placed on this flat surface. I need techniques which are able to take a starting point, move in a certain way (the algorithm), find nodes and continue searching. I do not have an overall view of the surface (i.e. I cannot see everything), only a limited view (i.e. 4 cells in any direction). Ideally, these methods would be efficient in the way that they work.
Any points in the right direction would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
地图大小是无限的,还是即使您忽略起始位置,您也知道尺寸吗?是探索起始位置更好,还是目标是在最短的时间内探索最多数量的细胞?
如果您想通过无限的 8 连接地图和各个方向的 4 单元可视性来探索您的社区,只需进行对角螺旋即可。如果网格是有限的,并且您知道尺寸,那么最好朝同一方向前进,直到撞到墙壁(这会暴露您的位置),这样您就可以从那时起更好地计划您的移动。
Is the map size infinite, or do you know the dimensions, even if you ignore your starting position? Is it better to explore your starting position, or is the goal to explore greatest number of cells in minimal time?
If you want to explore your neighborhood with an infinite 8-connected map and 4-cell visibility in all directions, just do diagonal spirals. If the grid is finite, and you know the dimensions, it may be better to go in the same direction until you hit a wall (which will reveal your position), so you can plan your movements better from then on.
使用洪水填充的变体 - 只需在填充每个像素后添加对节点的检查。
Use a variant of flood fill - just add checking for a node after each pixel is filled.