Differences From Artifact [df1ca9c8d7e8adb9]:
- File
src/solver.d
- 2012-07-15 02:24:14 - part of checkin [9f1a8c70cd] on branch trunk - Razor using solver. (user: kinaba) [annotate]
To 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]
1 import util; 1 import util;
2 import game; 2 import game;
3 3
4 class Solver_0 4 class Solver_0
5 { 5 {
6 this(const(Game) g) {} 6 this(const(Game) g) {}
7 char single_step() { return 'W'; } 7 char single_step() { return 'W'; }
> 8 void force(char c) {}
8 } 9 }
9 10
10 class Solver_1 11 class Solver_1
11 { 12 {
12 int wait_count = 0; 13 int wait_count = 0;
13 int choke_count = 0; 14 int choke_count = 0;
14 15
................................................................................................................................................................................
22 char single_step() 23 char single_step()
23 { 24 {
24 Tuple!(string,int) de = death_move(g); 25 Tuple!(string,int) de = death_move(g);
25 char c = act(g, de[0], de[1]); 26 char c = act(g, de[0], de[1]);
26 g.command(c); 27 g.command(c);
27 return c; 28 return c;
28 } 29 }
> 30
> 31 void force(char c)
> 32 {
> 33 g.command(c);
> 34 }
29 35
30 Tuple!(string,int) death_move(const(Game) g) 36 Tuple!(string,int) death_move(const(Game) g)
31 { 37 {
32 string death; 38 string death;
33 int choice = 0; 39 int choice = 0;
34 foreach(char c; "UDLRW") { 40 foreach(char c; "UDLRW") {
35 Game gg = g.clone(); 41 Game gg = g.clone();