Check-in [aea6cfc7e3]
Not logged in
Overview
SHA1 Hash:aea6cfc7e34b68c61540a776c0cde4c8c28fa08e
Date: 2012-07-14 23:33:25
User: kinaba
Comment:further clean up.
Timelines: family | ancestors | descendants | both | trunk
Diffs: redesign
Downloads: Tarball | ZIP archive
Other Links: files | file ages | manifest
Tags And Properties
Changes

Modified src/cui_auto_main.d from [d3f73764386d7688] to [8844bb07a00188c5].

5 import solver; 5 import solver; 6 6 7 class CUI(Solver) : GameObserver 7 class CUI(Solver) : GameObserver 8 { 8 { 9 this(in Game g) { solver = new Solver(g); } 9 this(in Game g) { solver = new Solver(g); } 10 Solver solver; 10 Solver solver; 11 bool fin; 11 bool fin; 12 override void on_game_changed(char c, const(Game) g, bool finished) | 12 override void on_game_changed(char c, in Game g, bool finished) 13 { 13 { 14 fin = finished; 14 fin = finished; 15 } 15 } 16 } 16 } 17 17 18 void main(string[] args) 18 void main(string[] args) 19 { 19 { 20 Driver d = new Driver(stdin); 20 Driver d = new Driver(stdin); 21 d.addObserver!(GuardedOutput)(); 21 d.addObserver!(GuardedOutput)(); 22 auto c = d.addObserver!(CUI!Solver_1)(); 22 auto c = d.addObserver!(CUI!Solver_1)(); 23 while(!c.fin) 23 while(!c.fin) 24 d.command(c.solver.single_step()); 24 d.command(c.solver.single_step()); 25 } 25 }

Modified src/gui.d from [f5e549c65e603be1] to [e185ff3281d95738].

27 }; 27 }; 28 t.start(); 28 t.start(); 29 this.closing ~= (Form f,CancelEventArgs c){t.stop();}; 29 this.closing ~= (Form f,CancelEventArgs c){t.stop();}; 30 } 30 } 31 Application.run(this); 31 Application.run(this); 32 } 32 } 33 33 34 override void on_game_changed(char c, const(Game) g, bool finished) | 34 override void on_game_changed(char c, in Game g, bool finished) 35 { 35 { 36 draw(g); 36 draw(g); 37 } 37 } 38 38 39 private: 39 private: 40 int cell; 40 int cell; 41 41 ................................................................................................................................................................................ 77 this.render['L'] = "☒"; 77 this.render['L'] = "☒"; 78 this.render['O'] = "☐"; 78 this.render['O'] = "☐"; 79 this.paint ~= (Control c, PaintEventArgs ev) { 79 this.paint ~= (Control c, PaintEventArgs ev) { 80 graphicContext.copyTo(ev.graphics, Rect(0,0,this.clientS 80 graphicContext.copyTo(ev.graphics, Rect(0,0,this.clientS 81 }; 81 }; 82 } 82 } 83 83 84 void draw(const(Game) g) | 84 void draw(in Game g) 85 { 85 { 86 int scrW = this.clientSize.width; 86 int scrW = this.clientSize.width; 87 int scrH = this.clientSize.height; 87 int scrH = this.clientSize.height; 88 88 89 // Fill bg. 89 // Fill bg. 90 graphicContext.fillRectangle(this.backColor, Rect(0,0,scrW,scrH) 90 graphicContext.fillRectangle(this.backColor, Rect(0,0,scrW,scrH) 91 91

Modified src/solver.d from [ee353f733f706a26] to [6a465bd844fac2d9].

1 import util; 1 import util; 2 import game; 2 import game; 3 import driver; < 4 < 5 /* < 6 interface Solver < 7 { < 8 this(const(Game) g); < 9 char single_step(); < 10 } < 11 */ < 12 3 13 class Solver_0 4 class Solver_0 14 { 5 { 15 this(const(Game) g) {} 6 this(const(Game) g) {} 16 char single_step() { return 'W'; } 7 char single_step() { return 'W'; } 17 } 8 } 18 9