Differences From Artifact [2ca374354297c908]:
- File
src/output.d
- 2012-07-14 11:24:30 - part of checkin [bee0596f0f] on branch trunk - Refactoring. (user: kinaba) [annotate]
To Artifact [7fa423ba9f8ebe92]:
- File
src/output.d
- 2012-07-14 12:29:17 - part of checkin [9d4aca73fa] on branch trunk - GUI+Solver revived. (user: kinaba) [annotate]
1 1 import util;
2 2 import game;
3 3 import driver;
4 -import std.c.stdlib;
5 4 import core.stdc.signal;
6 5
7 6 class NilOutput : GameObserver
8 7 {
9 8 this(const(Game) g) {}
10 - override bool on_game_changed(char c, const(Game) g, bool finished) {return false;}
9 + override void on_game_changed(char c, const(Game) g, bool finished) {}
11 10 }
12 11
13 12 class StdOutput : GameObserver
14 13 {
15 14 this(const(Game) g) {}
16 - override bool on_game_changed(char c, const(Game) g, bool finished)
15 + override void on_game_changed(char c, const(Game) g, bool finished)
17 16 {
18 17 stdout.write(c);
19 18 stdout.flush();
20 - return false;
21 19 }
22 20 }
23 21
24 22 class GuardedOutput : GameObserver
25 23 {
26 24 this(const(Game) g)
27 25 {
28 26 setup_sigint_handling();
29 27 ideal_log ~= g.score_if_abort_now;
30 28 }
31 29
32 - override bool on_game_changed(char c, const(Game) g, bool finished)
30 + override void on_game_changed(char c, const(Game) g, bool finished)
33 31 {
34 32 log ~= c;
35 33 score_log ~= g.score;
36 34 ideal_log ~= g.score_if_abort_now;
37 35 if(finished)
38 36 flush();
39 - return false;
40 37 }
41 38
42 39 private:
43 40 string log;
44 41 long[] score_log;
45 42 long[] ideal_log;
46 43