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 54 Tuple!(Pos, int)[] log;
55 55 bool[][] forbidden_cell;
56 56
57 57 char act(const(Game) g, string death, int breath)
58 58 {
59 - const Pos ro = g.map.robot;
60 - const Pos[] la = g.map.lambdas();
61 - const Pos[] ra = g.map.razors();
62 - const Pos li = g.map.lift;
63 - const Pos[] hi = g.map.objects('W');
59 + const Pos ro = g.map.robot;
60 + const Pos li = g.map.lift;
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);
67 + Pos[] ra = g.map.razors();
68 + const(Pos)[] hi = g.map.objects('W');
64 69
65 70 Tuple!(char,int)[] cand;
66 71 char c = 'W';
67 72 if( la.empty ) {
68 73 cand = search(g, ro, [li], death);
69 74 } else {
70 75 cand ~= search(g, ro, la~ra, death);