Differences From Artifact [95ed42a2d89e1fef]:
- File
src/output.d
- 2012-07-15 14:07:16 - part of checkin [a487d35804] on branch trunk - test (user: kinaba) [annotate]
To Artifact [bdd3d4d83c822b4b]:
- File
src/output.d
- 2012-07-16 06:32:03 - part of checkin [1b261bd13b] on branch trunk - Run Wind and Forest both and take better. (user: kinaba) [annotate]
36 36 log ~= c;
37 37 score_log ~= g.score;
38 38 if(finished || log.length+1==g.map.W*g.map.H)
39 39 flush();
40 40 if(log.length+1==g.map.W*g.map.H)
41 41 application_exit();
42 42 }
43 +
44 + void safety_data(string s_log, long[] s_score_log) {
45 + this.s_log = s_log;
46 + this.s_score_log = s_score_log;
47 + }
43 48
44 49 private:
45 50 string log;
46 51 long[] score_log;
47 52 bool flushed;
48 53
54 + string s_log;
55 + long[] s_score_log;
56 +
49 57 void flush()
50 58 {
51 59 if(flushed)
52 60 return;
53 61
54 - Tuple!(long, int) cand;
62 + Tuple!(long, int, immutable(char)*) cand;
55 63 cand[0] = long.min;
56 64
57 65 for(int i=0; i<score_log.length; ++i)
58 66 if(cand[0] < score_log[i])
59 - cand = tuple(score_log[i],i);
67 + cand = tuple(score_log[i],i,log.ptr);
68 + for(int i=0; i<s_score_log.length; ++i)
69 + if(cand[0] < s_score_log[i])
70 + cand = tuple(s_score_log[i],i,s_log.ptr);
60 71
61 - std.c.stdio.printf("%.*sA\n", cand[1], log.ptr);
72 + std.c.stdio.printf("%.*sA\n", cand[1], cand[2]);
62 73 std.c.stdio.fflush(std.c.stdio.stdout);
63 74 flushed = true;
64 75 }
65 76
66 77 private:
67 78 static __gshared GuardedOutput g_output;
68 79