Tesi Robotica Analisi, progettazione e implementazione... | Page 140

i i “LP_Tesi” — 2013/10/17 — 18:27 — page 140 — #140 i 140 i 6. SECONDA RELEASE Algoritmo 6.13 Regole per il calcolo delle direzioni Pt.2 1 2 3 4 5 rule r4 (step==0 && addr>size && addr==row−1 && col!=0); delta .deq(); BitScore cWest, cond; if (ramNorth.first() . dir!=NORTH) cond=gap; else cond=egap; 6 7 8 9 if (gapWest!=WEST) cWest = west + gap; else cWest = west + egap; northWest <= ramNorth.first().score; 10 11 12 13 14 15 16 17 18 let maxi = maxuw(maxu,cWest); maxu <= BitScoreDir{dir:NORTHWEST, score:delta.first+north}; result .enq(maxi); north<=ramNorth.first().score; ramNorth.enq(maxi); gapWest<=maxi.dir; west<=maxi.score; endrule 19 20 21 22 23 24 rule r5 (step==0 && addr>size && addr!=row && addr!=row−1 && col!=0); delta .deq(); ramNorth.deq(); BitScore cWest, cond; if (ramNorth.first() . dir!=NORTH) cond=gap; else cond=egap; 25 26 27 28 if (gapWest!=WEST) cWest = west + gap; else cWest = west + egap; northWest <= ramNorth.first().score; 29 30 31 32 33 34 35 36 37 let maxi = maxuw(maxu,cWest); maxu <= maxnwn(delta.first+north,ramNorth.first().score+cond); result .enq(maxi); north<=ramNorth.first().score; ramNorth.enq(maxi); gapWest<=maxi.dir; west<=maxi.score; endrule 38 39 40 41 42 43 44 45 46 47 48 49 50 rule rlast (step==1); ramNorth.deq(); BitScore cWest; if (gapWest!=WEST) cWest = west + gap; else cWest = west + egap; BitScore cond; if (ramNorth.first() . dir!=NORTH) cond=gap; else cond=egap; let maxi = maxuw(maxu,cWest); result .enq(maxi); step<=2; endrule i i i i