mazemap识别生成遍历所有房间的robot(文本)
本帖最后由 feiwen 于 2011-2-16 22:29 编辑#ALIAS maze_map {maze_r_x=0;maze_r_y=0;maze_x=0;#var maze_lines "";mazemap}
#ALIAS maze_addline {#var maze_lines %concat(@maze_lines,"|",%1);#if (%left(@maze_lines,1)="|") {maze_lines=%right(@maze_lines,1)}}
#ALIAS maze_run {maze_r_x=0;maze_r_y=0;maze_rxy}
#ALIAS array_add {#var _array_add_tmp "";#var _aatmp1 "";#var _array_add_1 @%concat(%1,"_1");#var _array_add_2 @%concat(%1,"_2");#loop 1,@_array_add_1 {#var _array_add_line %word(@%1,%i,@array_space_1);#if (%i=%2) {#var _aatmp1 "";#loop 1,@_array_add_2 {#var _aatmp2 %word(@_array_add_line,%i,@array_space_2);#if (%i=%3) {_aatmp2=%4};#var _aatmp1 %concat(@_aatmp1,@array_space_2,@_aatmp2)};#var _aatmp1 %right(@_aatmp1,1);} {#var _aatmp1 @_array_add_line};#var _array_add_tmp %concat(@_array_add_tmp,@array_space_1,@_aatmp1);};%1=%right(@_array_add_tmp,1)}
#ALIAS array_get {#var %4 %word(%word(@%1,%2,@array_space_1),%3,@array_space_2);#show @%4}
#ALIAS array_init {#var _array_tmp %concat(%repeat(@array_space_2,%3-1),@array_space_1);#var %1 %repeat(@_array_tmp,%2);#var %1 %leftback(@%1,1);#var %concat(%1,"_1") %2;#var %concat(%1,"_2") %3}
#ALIAS maze_roomfx {#var maze_roomfxs "";#loop 1,49 {#math maze_room_x %mod(%i-1,7)+1;#math maze_room_y (%i-1-%mod(%i-1,7))/7+1;#math __y @maze_room_y*2;#var __line %word(@maze_lines,@__y,"|");#var __line0 %word(@maze_lines,@__y-1,"|");#var __line1 %word(@maze_lines,@__y+1,"|");#math _e %i+1;#math _s %i+7;#math _w %i-1;#math _n %i-7;#if (%mod(@_e,7)<>1) {#var _a %if(%left(%right(@__line,@maze_room_x*4),2)="",%concat(@_e,"/"),"");} {#var _a ""};#var _b %if(%left(%right(@__line1,@maze_room_x*4-2),2)="",%concat(@_s,"/"),"");#if (%mod(@_w,7)<>0) {#var _c %if(%left(%right(@__line,@maze_room_x*4-4),2)="",%concat(@_w,"/"),"");} {#var _c ""};#var _d %if(%left(%right(@__line0,@maze_room_x*4-2),2)="",%concat(@_n,"/"),"");#var maze_roomfxs %concat(@maze_roomfxs,"|",%leftback(%concat(@_a,@_b,@_c,@_d),1));};maze_roomfxs=%right(@maze_roomfxs,1)}
#ALIAS maze_rxy {#var _maze_cnt 0;#forall @maze_lines {#add _maze_cnt 1;#if (%pos("★",%i)>0) {#math maze_r_y @_maze_cnt/2;#math maze_r_x (%pos("★",%i)+1)/4;#math maze_r_hang @_maze_cnt/2;#math maze_r_lie (%pos("★",%i)+1)/4;#show "★";}};#math maze_enter (@maze_r_y-1)*7+@maze_r_x;#show e x y:@maze_enter @maze_r_x @maze_r_y}
#ALIAS maze_push {#var %1 %concat(%2,|,@%1)}
#ALIAS maze_prev {#var maze_tmp %pos("|",@%1);#if (maze_tmp>0) {#math maze_tmp1 @maze_tmp-1;#var %2 %left(@%1,@maze_tmp1)}}
#ALIAS maze_findpath_back {maze_pop maze_stack_path _maze_s_p;maze_prev maze_stack_path _maze_s_p;maze_pop maze_stack_room_out _maze_s_r;maze_popr _maze_s_r _maze_s_r1;#if (@_maze_s_p="") {#show %ansi(white,red)计算路径完成;} {maze_push maze_all_path @_maze_s_p;#if (@_maze_s_r1="") {maze_findpath_back} {maze_push maze_stack_room_out @_maze_s_r;maze_findpath_before @_maze_s_p @_maze_s_r1 %word(@maze_roomfxs,@_maze_s_r1,"|");}}}
#ALIAS maze_findpath {#var maze_all_path "";#var maze_stack_path "";#var maze_stack_room_out "";#var maze_before_room 0;maze_findpath_before @maze_before_room @maze_enter %word(@maze_roomfxs,@maze_enter,"|");#show @maze_all_path}
#ALIAS maze_findpath_before {#var arg1 %1;#var arg2 %2;#var arg3 %3;maze_push maze_all_path @arg2;maze_push maze_stack_path @arg2;#var _maze_path_tmp @arg3;maze_room_pop _maze_path_tmp _maze_path_tmp1 @arg1;#if (@_maze_path_tmp1="") {maze_findpath_back} {maze_push maze_stack_room_out @_maze_path_tmp; #alias mazenext {maze_findpath_before @arg2 @_maze_path_tmp1 %word(@maze_roomfxs,@_maze_path_tmp1,"|")};#if (@maze_debug=1) {#show debug:@maze_all_path;#show %ansi(white,green)输入mazenext进行下一步;} {mazenext;}}}
#ALIAS debugnext {maze_findpath_before @_maze_path_tmp1 %word(@maze_roomfxs,@_maze_path_tmp1,"|")}
#ALIAS mazenext {maze_findpath_before @arg2 @_maze_path_tmp1 %word(@maze_roomfxs,@_maze_path_tmp1,"|")}
#ALIAS maze_room_pop {#math _mrp_tmp %numwords(@%1,"/")+1;#var _mrp_tmp1 "";#var _mrp_tmp2 "";#var _mrp_tag 0;#if (%3<>0) {_mrp_tmp1=%replace(%concat("/",@%1,"/"),%concat("/",%3,"/"),"/");#var _mrp_tmp1 %leftback(%right(@_mrp_tmp1,1),1);} {#var _mrp_tmp1 @%1};#math maze_cnt %pos("/",@_mrp_tmp1);#math maze_cnt1 @maze_cnt-1;#if (@maze_cnt>0) {#var %2 %left(@_mrp_tmp1,@maze_cnt1);#var %1 %right(@_mrp_tmp1,@maze_cnt)} {#var %2 @_mrp_tmp1;#var %1 ""}}
#ALIAS maze_pop {#math maze_tmp %pos("|",@%1);#math maze_tmp1 %pos("|",@%1)-1;#if (@maze_tmp>0) {#var %2 %left(@%1,@maze_tmp1);#var %1 %right(@%1,@maze_tmp)} {#var %2 @%1;#var %1 ""}}
#ALIAS maze_prevr {#math maze_tmp %pos("/",@%1);#math maze_tmp1 %pos("/",@%1)-1;#if (@maze_tmp>0) {#var %2 %left(@%1,@maze_tmp1);} {#var %2 @%1}}
#ALIAS maze_popr {#math maze_tmp %pos("/",@%1);#math maze_tmp1 %pos("/",@%1)-1;#if (@maze_tmp>0) {#var %2 %left(@%1,@maze_tmp1);#var %1 %right(@%1,@maze_tmp)} {#var %2 @%1;#var %1 ""}}
#ALIAS mazego_start {#var mazegolist "";#var maze_all_path_bak @maze_all_path;mazego_next}
#ALIAS mazego_next {maze_pop maze_all_path_bak mazego_now;maze_prev maze_all_path_bak mazego_next;#math mazego_c @mazego_now-@mazego_next;#var mazego_nextstep %if(@mazego_c=-1,"e",%if(@mazego_c=-7,"s",%if(@mazego_c=1,"w",%if(@mazego_c=-1,"n","mazeend"))))}
#ALIAS mazego_go {#if (@mazegolist="") {maze_push mazegolist @mazego_nextstep;} {mazego_ffx @mazego_nextstep _mazego_fx;maze_prev mazegolist _mazego_prev;#show @_mazego_fx @_mazego_prev;#if (@_mazego_fx=@_mazego_prev) {maze_pop mazegolist _mazego_prev;} {maze_push mazegolist @mazego_nextstep;}};<@mazego_nextstep>}
#ALIAS mazego_ffx {#forall @maze_fx {#var _maze_tmp3 %word(%i,1,";");#var _maze_tmp4 %word(%i,2,";");#if (@_maze_tmp3=%1) {#var %2 @_maze_tmp4;_maze_tmp=0} {#if (@_maze_tmp4=%1) {#var %2 @_maze_tmp3;_maze_tmp=0}};}}
#ALIAS mazeend {e;l}
#FUNC maze_enter_x {0}
#FUNC maze_enter_y {0}
#FUNC maze_x {15}
#FUNC maze_lines {┌─┬─┬─┬─┬─┬─┬─┐|│ │ │|├┼─┼┼┼─┼┼─┤|││ ││ │|├┼─┼┼─┼─┼─┼─┤|││ ││|├┼─┼─┼┼─┼┼┤|││ │ │|├┼─┼─┼─┼─┼┼─┤|│ │ ││★│|├┼─┼─┼┼─┼┼┤|│ │ │ │|├─┼┼┼┼┼┼─┤|│ ││ │|└─┴─┴─┴─┴─┴─┴─┘}
#FUNC _maze_cnt {15}
#FUNC maze_r_y {5}
#FUNC maze_r_x {7}
#FUNC maze_r_hang {5}
#FUNC maze_r_lie {7}
#FUNC _array_tmp {;;;|}
#FUNC array_space_2 {;}
#FUNC array_space_1 {|}
#FUNC _array_add_tmp {|e;s;;|e;;w;|;;w;|e;;w;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;|;;;}
#FUNC _array_add_1 {@maze_roomfxs_1}
#FUNC _array_add_2 {@maze_roomfxs_2}
#FUNC _array_add_tmp_1 {;;;;;;;}
#FUNC _array_add_line {;;;}
#FUNC init {@init}
#FUNC _aatmp2 {}
#FUNC _aatmp1 {;;;}
#FUNC _array_line {32323;32323;abc;;;;}
#FUNC maze_room_x {7}
#FUNC maze_room_y {7}
#FUNC __y {14}
#FUNC __line {│ ││ │}
#FUNC __line0 {├─┼┼┼┼┼┼─┤}
#FUNC __line1 {└─┴─┴─┴─┴─┴─┴─┘}
#FUNC maze_roomfxs {2/8|1|4/10|5/11/3|6/4|7/13/5|6|15/1|10|17/9/3|4|13|14/12/6|13|22/8|17|18/16/10|19/25/17|20/18|27/19|28|29/15|24|25/23|26/24/18|25|28/34/20|27/21|30/36/22|31/29|30|33/39|32|41/27|42|37/29|44/36|39/45|40/46/38/32|47/39|42/48/34|41/35|44|45/43/37|44/38|39|48/40|49/47/41|48}
#FUNC _a {""}
#FUNC _b {""}
#FUNC _c {48/}
#FUNC _d {""}
#FUNC _e {50}
#FUNC _s {56}
#FUNC _w {48}
#FUNC _n {42}
#FUNC test {c}
#FUNC maze_tmp {2}
#FUNC maze_tmp1 {1}
#FUNC tttt {a}
#FUNC maze_enter {35}
#FUNC maze_debug {0}
#FUNC maze_all_path {35|42|41|34|27|20|19|18|17|10|3|4|11|4|5|6|13|12|13|14|13|6|7|6|5|4|3|10|9|10|17|16|17|18|25|24|23|24|25|26|25|18|19|20|27|28|21|28|27|34|41|48|47|40|39|32|33|32|39|38|45|44|37|36|29|22|15|8|1|2|1|8|15|22|29|30|31|30|29|36|37|44|43|44|45|38|39|46|39|40|47|48|49|48|41|42|35|}
#FUNC maze_stack_path {""}
#FUNC _maze_path_tmp {""}
#FUNC _maze_path_tmp1 {""}
#FUNC _maze_s_p {""}
#FUNC _maze_s_r {""}
#FUNC _maze_s_r1 {""}
#FUNC maze_before_room {0}
#FUNC _mrp_tmp {2}
#FUNC _mrp_tmp1 {""}
#FUNC _mrp_tag {0}
#FUNC maze_cnt {0}
#FUNC maze_cnt1 {-1}
#FUNC _mrp_tmp2 {""}
#FUNC maze_stack_room_out {""}
#FUNC _maze_up {_maze_path_tmp}
#FUNC arg1 {4}
#FUNC arg2 {11}
#FUNC arg3 {4}
#FUNC maze_fx {e;w|s;n}
#FUNC _maze_tmp3 {s}
#FUNC _maze_tmp4 {n}
#FUNC fx {s}
#FUNC mazegolist {n|n|n|}
#FUNC maze_all_path_bak {""}
#FUNC mazego_now {""}
#FUNC mazego_next {""}
#FUNC mazego_c {0}
#FUNC mazego_nextstep {n}
#FUNC _mazego_prev {n}
#FUNC _mazego_fx {s}
#TRIGGER {^{┌|│|├|└}} {#add maze_x 1;maze_addline %trigger} {mazemap} 548
#TRIGGER {^本副本将在(*)后消失。} {#t- mazemap;maze_run} {mazemap} 548 在迷宫入口所在的房间输入maze_map等计算完后输入mazego_next获得下一步的方向,输入mazego_go走下一步,如果想要返回入口处可以通过@mazegolist反向行走,即可仅供学习讨论。 严重支持,牛人啊 本帖最后由 秋风画扇 于 2011-2-17 17:19 编辑
为什么不走路,我全部敲打进去了,不好使诶
后来在群里下了个,还是不管用{:soso_e105:} 4# 秋风画扇
这个就是算路径的,走路的已经发到群共享了,还是供讨论改造的 今后你用 副本 来替代 forest pfm 命令。
这是什么意思,哪里没设置对吗? 没啥问题 用来触发下一步操作的 你指入口係hunter west west? 請問這個是可以用來走forest嗎??
zmud 4.62能用嗎?? 没有一定的编程基础就不要看这个了, 森林有现成的机器人下载
页:
[1]