手里有原始地图坐标,数组形式,例如step":7,killer":1
[0,0,0,0,0,0,0]
[0,0,0,0,0,0,0]
[1,1,1,0,0,6,0]
[1,1,1,1,1,1,0]
[1,1,5,1,1,1,0]
[2,1,1,1,1,9,0]
[0,1,1,1,1,7,0]
[0,1,1,1,1,8,0]
[0,0,0,0,0,0,0]
[0,0,0,0,0,0,0]
其中: - 0 表示陷阱
- 1 表示普通地面
- 2 表示目标位置
- 3 表示陷阱
- 4 表示陷阱
- 5 表示陷阱
- 6 表示陷阱
- 7 敌人攻击范围
- 8 表示玩家的位置
- 9 表示敌人
胜利条件是杀死所有敌人+步数用完+最后人物到达
下面是游戏路径数据,发送了当前人物坐标和目标坐标以及朝向
{"当前坐标":{"x":5,"y":7},"移动到坐标":{"x":1,"y":7},"map":[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[1,1,1,0,0,6,0],[1,1,1,1,1,1,0],[1,1,5,1,1,1,0],[2,1,1,1,1,9,0],[0,1,1,1,1,7,0],[0,1,1,1,1,8,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]],,"direction":3}
{"当前坐标":{"x":1,"y":7},"移动到坐标":{"x":5,"y":7},"map":[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[1,1,1,0,0,6,0],[1,1,1,1,1,1,0],[1,1,5,1,1,1,0],[2,1,1,1,1,9,0],[0,1,1,1,1,7,0],[0,8,1,1,1,1,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]],,"direction":2}
{"当前坐标":{"x":5,"y":7},"移动到坐标":{"x":1,"y":7},"map":[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[1,1,1,0,0,6,0],[1,1,1,1,1,1,0],[1,1,5,1,1,1,0],[2,1,1,1,1,9,0],[0,1,1,1,1,7,0],[0,1,1,1,1,8,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]],,"direction":3}
{"当前坐标":{"x":1,"y":7},"移动到坐标":{"x":5,"y":7},"map":[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[1,1,1,0,0,6,0],[1,1,1,1,1,1,0],[1,1,5,1,1,1,0],[2,1,1,1,1,9,0],[0,1,1,1,1,7,0],[0,8,1,1,1,1,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]],,"direction":2}
{"当前坐标":{"x":5,"y":7},"移动到坐标":{"x":1,"y":7},"map":[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[1,1,1,0,0,6,0],[1,1,1,1,1,1,0],[1,1,5,1,1,1,0],[2,1,1,1,1,9,0],[0,1,1,1,1,7,0],[0,1,1,1,1,8,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]],,"direction":3}
{"当前坐标":{"x":1,"y":7},"移动到坐标":{"x":5,"y":7},"map":[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[1,1,1,0,0,6,0],[1,1,1,1,1,1,0],[1,1,5,1,1,1,0],[2,1,1,1,1,9,0],[0,1,1,1,1,7,0],[0,8,1,1,1,1,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]],,"direction":2}
{"当前坐标":{"x":5,"y":5},"移动到坐标":{"x":0,"y":5},"map":[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[1,1,1,0,0,6,0],[1,1,1,1,1,1,0],[1,1,5,1,1,1,0],[2,1,1,1,1,8,0],[0,1,1,1,1,1,0],[0,1,1,1,1,1,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]],,"direction":3}
到此胜利,想要一个算法或者能模块,能够根据数组地图输出每一步的坐标和移动后的地图数组
可以定制的话私聊我。谢谢
补充内容 (2023-11-13 19:00):
http://mwx.sanguosha.cn/h5game_jieyingbaoweizhan/index.html#/
参考这个VX网页 |