装配中的机器人探索问题 (emu8086)
我正在使用 emu8086 编写一个汇编程序。该程序使用内置机器人设备在模拟 6x9 地图上模拟虚拟机器人。该地图将包含未知数量的墙壁和灯(点亮/未点亮),机器人将在其中遍历地图并找到所有未点亮的灯并点亮它们。机器人本身只能从机器人所面对的相邻方格获取数据,并且只能旋转 90 度。 该项目建议将左上角作为坐标系的原点 (0,0)。
我了解如何将机器人与我的代码连接起来移动和检查数据,但是,我不确定如何有效地遍历并检查整个地图上的所有灯,而不陷入无限循环或死胡同。
我读过有关使用多种搜索算法的信息,例如广度优先和深度优先搜索算法,但我不确定如何在汇编中实现这些概念(因为大多数示例/伪代码是用 c++/c#/etc 编写的)。
我并不要求任何特定的编码,而是要求了解如何实现这些搜索功能。由于问题提到了坐标系的原点,因此我创建了一个二维数组,在其中获取特定坐标处的对象的值。不确定数组对于这个问题有多重要,但是任何帮助将不胜感激。
I'm working on an assembly program using the emu8086. The program uses the built-in robot device to emulate a virtual robot on a simulated 6x9 map. The map will contain unknown amounts of walls and lamps(lit/unlit) in which the robot is to traverse through the map and located all the unlit lamps and light them. The robot itself, can only take data from adjacent squares in which the robot is facing, and also can rotate in only 90 degree turns.
The project suggests that the upper-left hand corner will be the origin of the coordinate system (0,0).
I understand how to interface the robot with my code to move and examine data, however, I'm not sure of how to efficiently travel through and check for all lamps on the entire map, without falling into an infinite loop or dead end.
I've read about using several search algorithm such as the breadth-first and depth-first search algorithms, but I am unsure of how to implement such concepts in assembly (as most of the example/psuedocode is written in c++/c#/etc).
I'm not asking for any specific coding, but insight on how to implement those search functions. Since the problem mentions an origin for a coordinate system, I made a 2d array in which to take values for objects at certain coordinates. Not sure how important the array is for the problem, but any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为此,我建议创建一个漂亮的小集合(列表/队列/集合)库首先。
For this, I'd recommend to create a nice little collection (list/queue/set) library to start with.