Differences From Artifact [98744373e0968733]:
- File
src/solver.d
- 2012-07-15 02:37:41 - part of checkin [c2c105fda0] on branch trunk - Support 'G' at any timing. (user: kinaba) [annotate]
To Artifact [ede3d182d99f2de5]:
- File
src/solver.d
- 2012-07-15 04:44:33 - part of checkin [879099f815] on branch trunk - Moved 'abort' behavior completely out of Game. (user: kinaba) [annotate]
1 1 import util;
2 2 import game;
3 3
4 4 class Solver_0
5 5 {
6 - this(const(Game) g) {}
6 + this(in Game g) {}
7 7 char single_step() { return 'W'; }
8 8 void force(char c) {}
9 9 }
10 10
11 11 class Solver_1
12 12 {
13 13 int wait_count = 0;
14 14 int choke_count = 0;
15 15
16 16 Game g;
17 - this(const(Game) g)
17 + this(in Game g)
18 18 {
19 19 this.g = g.clone();
20 20 forbidden_cell = new bool[][](g.map.H+2, g.map.W+2);
21 21 }
22 22
23 23 char single_step()
24 24 {
25 25 Tuple!(string,int) de = death_move(g);
26 26 char c = act(g, de[0], de[1]);
27 - g.command(c);
27 + force(c);
28 28 return c;
29 29 }
30 30
31 31 void force(char c)
32 32 {
33 - g.command(c);
33 + if(c != 'A')
34 + g.command(c);
34 35 }
35 36
36 37 Tuple!(string,int) death_move(const(Game) g)
37 38 {
38 39 string death;
39 40 int choice = 0;
40 41 foreach(char c; "UDLRW") {