Overview
SHA1 Hash: | c743b817b7fd6aea797c6c306dd32619700799eb |
---|---|
Date: | 2012-07-14 23:56:19 |
User: | kinaba |
Comment: | death avoider for 'W'. |
Timelines: | family | ancestors | descendants | both | trunk |
Diffs: | redesign |
Downloads: | Tarball | ZIP archive |
Other Links: | files | file ages | manifest |
Tags And Properties
- branch=trunk inherited from [16f0b5784f]
- sym-trunk inherited from [16f0b5784f]
Changes
Modified src/solver.d from [6a465bd844fac2d9] to [1708425009125a5d].
5 5 { 6 6 this(const(Game) g) {} 7 7 char single_step() { return 'W'; } 8 8 } 9 9 10 10 class Solver_1 11 11 { 12 - int g_wc = 0; 12 + int wait_count = 0; 13 13 14 14 Game g; 15 15 this(const(Game) g) 16 16 { 17 17 this.g = g.clone(); 18 18 forbidden_cell = new bool[][](g.map.H+2, g.map.W+2); 19 19 } ................................................................................ 61 61 cand ~= tuple('W',int.max); 62 62 sort!((Tuple!(char,int) c1, Tuple!(char,int) c2){ 63 63 if(c1[1] != c2[1]) 64 64 return c1[1] < c2[1]; 65 65 return c1[0] < c2[0]; 66 66 })(cand); 67 67 c = cand[0][0]; 68 + 69 + if(death.count(c)) { 70 + foreach(char live; "UDLRWA") 71 + if(death.count(live)==0) { 72 + c=live; 73 + break; 74 + } 75 + } 68 76 69 77 if(c=='W') { 70 - g_wc++; 71 - if(g_wc > 10) 78 + wait_count++; 79 + if(wait_count > g.map.H) 72 80 c = 'A'; 73 81 } 74 82 else 75 - g_wc = 0; 83 + wait_count = 0; 84 + 76 85 bool[char] choice; 77 86 foreach(t; cand) 78 87 choice[t[0]] = true; 79 88 log ~= tuple(ro.clone(), cast(int)choice.length); 80 89 if(log.length > 5) 81 90 log = log[$-5..$]; 82 91 int cnt = 0;