Check-in [c2c105fda0]
Not logged in
Overview
SHA1 Hash:c2c105fda0142a8354a73f5ed7bbf58b7a6727f0
Date: 2012-07-15 11:37:41
User: kinaba
Comment:Support 'G' at any timing.
Timelines: family | ancestors | descendants | both | trunk
Diffs: redesign
Downloads: Tarball | ZIP archive
Other Links: files | file ages | manifest
Tags And Properties
Changes

Modified src/gui.d from [b071b446f6e834b9] to [d4577900b4db97c1].

129 129 130 130 private: 131 131 void setup_keyhandling() 132 132 { 133 133 noMessageFilter(); 134 134 this.keyDown ~= &my_keydown; 135 135 } 136 + 137 + void do_manual_command(char c) 138 + { 139 + solver.force(c); 140 + fn(c); 141 + } 136 142 137 143 void my_keydown(Control c, KeyEventArgs ev) 138 144 { 139 145 switch(ev.keyCode) 140 146 { 141 - case Keys.DOWN: fn('D'); break; 142 - case Keys.UP: fn('U'); break; 143 - case Keys.LEFT: fn('L'); break; 144 - case Keys.RIGHT: fn('R'); break; 145 - case Keys.W: fn('W'); break; 146 - case Keys.S: fn('S'); break; 147 - case Keys.A: fn('A'); break; 147 + case Keys.DOWN: do_manual_command('D'); break; 148 + case Keys.UP: do_manual_command('U'); break; 149 + case Keys.LEFT: do_manual_command('L'); break; 150 + case Keys.RIGHT: do_manual_command('R'); break; 151 + case Keys.W: do_manual_command('W'); break; 152 + case Keys.S: do_manual_command('S'); break; 153 + case Keys.A: do_manual_command('A'); break; 148 154 case Keys.G: fn(solver.single_step()); break; 149 155 default: break; 150 156 } 151 157 } 152 158 153 159 Solver solver; 154 160 }

Modified src/solver.d from [df1ca9c8d7e8adb9] to [98744373e0968733].

1 1 import util; 2 2 import game; 3 3 4 4 class Solver_0 5 5 { 6 6 this(const(Game) g) {} 7 7 char single_step() { return 'W'; } 8 + void force(char c) {} 8 9 } 9 10 10 11 class Solver_1 11 12 { 12 13 int wait_count = 0; 13 14 int choke_count = 0; 14 15 ................................................................................ 22 23 char single_step() 23 24 { 24 25 Tuple!(string,int) de = death_move(g); 25 26 char c = act(g, de[0], de[1]); 26 27 g.command(c); 27 28 return c; 28 29 } 30 + 31 + void force(char c) 32 + { 33 + g.command(c); 34 + } 29 35 30 36 Tuple!(string,int) death_move(const(Game) g) 31 37 { 32 38 string death; 33 39 int choice = 0; 34 40 foreach(char c; "UDLRW") { 35 41 Game gg = g.clone();