Differences From Artifact [dde2fe1d85562c17]:
- File
src/solver.d
- 2012-07-15 06:42:27 - part of checkin [0d078369c8] on branch trunk - score update & tweaked to solve contest2 (user: kinaba) [annotate]
To Artifact [57f6f73657cc3655]:
- File
src/solver.d
- 2012-07-15 07:02:32 - part of checkin [8acc8e6c78] on branch trunk - Prioritize distant lambda. (user: kinaba) [annotate]
52 } 52 }
53 53
54 Tuple!(Pos, int)[] log; 54 Tuple!(Pos, int)[] log;
55 bool[][] forbidden_cell; 55 bool[][] forbidden_cell;
56 56
57 char act(const(Game) g, string death, int breath) 57 char act(const(Game) g, string death, int breath)
58 { 58 {
59 const Pos ro = g.map.robot; | 59 const Pos ro = g.map.robot;
> 60 const Pos li = g.map.lift;
60 const Pos[] la = g.map.lambdas(); | 61 Pos[] la = g.map.lambdas();
> 62 sort!((Pos a,Pos b){
> 63 int ad=abs(a.y-li.y)+abs(a.x-li.x);
> 64 int bd=abs(b.y-li.y)+abs(b.x-li.x);
> 65 return ad>bd;;
> 66 })(la);
61 const Pos[] ra = g.map.razors(); | 67 Pos[] ra = g.map.razors();
62 const Pos li = g.map.lift; <
63 const Pos[] hi = g.map.objects('W'); | 68 const(Pos)[] hi = g.map.objects('W');
64 69
65 Tuple!(char,int)[] cand; 70 Tuple!(char,int)[] cand;
66 char c = 'W'; 71 char c = 'W';
67 if( la.empty ) { 72 if( la.empty ) {
68 cand = search(g, ro, [li], death); 73 cand = search(g, ro, [li], death);
69 } else { 74 } else {
70 cand ~= search(g, ro, la~ra, death); 75 cand ~= search(g, ro, la~ra, death);