《终极版》
1.需要一个处理器连结2个小内存和1个内存库使用(或3个小内存,见5)
2.处理器直接连结需要修复的建筑和修复器即可使用(可同时连结多个建筑和修复器,支持两种修复器同时使用)
3.精确到每个修复器的修复范围,现在每个修复器只在自己的修理范围内时有至少1个建筑受伤时工作(极限距离情况可能不准,比如Δx=4.5,Δy=2.5,s=5.15>5明明大于修复器范围,但是游戏却显示是在范围内的
,但是如果Δx=5,游戏里又显示不在不在范围内,麻了
)
4.修复了精确版响应奇慢的问题
(响应速度和处理器连结数量有关,连的太多了还是会慢
)
5.内存库可替换为1个小内存,需要把代码内两个bank1替换为cell3,只能连结(m+n)个单元(m*n<64),
6.我刷了6次屏了对不起!!
因为短短5个小时每次改到能用了就发,然后下次用发现有bug又删了,来来回回发了6次删了6次
,我保证这次98%能用了,要还有bug我也不改了
set build_pos 0
set build_num 0
set mend_pos 0
set mend_num 0
set count 0
getlink result count
sensor type result @type
jump 15 equal type @mender
jump 15 equal type @mend-projector
jump 18 equal type @memory-cell
jump 18 equal type @memory-bank
write count cell1 build_pos
op add build_num build_num 1
op add build_pos build_pos 1
jump 18 always x false
write count cell2 mend_pos
op add mend_num mend_num 1
op add mend_pos mend_pos 1
op add count count 1
jump 5 lessThan count @links
set bank_pos 0
set mend_pos 0
set build_pos 0
read pos cell2 mend_pos
op mul temp1 pos 100
op add mend_pos mend_pos 1
getlink mend pos
sensor x1 mend @x
sensor y1 mend @y
sensor type mend @type
read pos cell1 build_pos
op add build_pos build_pos 1
getlink build pos
sensor x2 build @x
sensor y2 build @y
op sub x x1 x2
op sub y y1 y2
op len distance x y
jump 41 equal type @mender
jump 45 greaterThanEq distance 10.62
jump 42 always distance 10.62
jump 45 greaterThanEq distance 5
op add temp2 temp1 pos
write temp2 bank1 bank_pos
op add bank_pos bank_pos 1
jump 30 lessThan build_pos build_num
jump 22 lessThan mend_pos mend_num
set mend_pos 0
set bank_pos 0
set switch 0
read pos1 cell2 mend_pos
op add mend_pos mend_pos 1
getlink mend pos1
read pos bank1 bank_pos
jump 0 notEqual count @links
op idiv pos2 pos 100
jump 66 notEqual pos1 pos2
op add bank_pos bank_pos 1
op add bank_pos bank_pos 1
op mod pos pos 100
getlink build pos
sensor health build @health
sensor maxhealth build @maxHealth
jump 65 equal health maxhealth
set switch 1
jump 53 equal pos1 pos2
jump 69 equal switch 1
control enabled mend 0 0 0 0
jump 70 always x false
control enabled mend 1 0 0 0
jump 49 lessThan mend_pos mend_num
jump 47 always x false