Differences From Artifact [7de11f2564488051]:
- File
src/solver.d
- 2012-07-16 04:17:22 - part of checkin [1110e2f932] on branch trunk - Migrated to no-clone deathmove (user: kinaba) [annotate]
To Artifact [ee76621ab7188714]:
- File
src/solver.d
- 2012-07-16 04:28:04 - part of checkin [e784787a7c] on branch trunk - Renamed solvers. (user: kinaba) [annotate]
> 1 //
> 2 // http://en.wikipedia.org/wiki/F%C5%ABrinkazan
> 3 //
1 import util; 4 import util;
2 import game; 5 import game;
3 6
4 bool is_spacy(char c) 7 bool is_spacy(char c)
5 { 8 {
6 return c==' ' || c=='.' || c=='R' || c=='!' || c=='\\' || c=='O'; 9 return c==' ' || c=='.' || c=='R' || c=='!' || c=='\\' || c=='O';
7 } 10 }
................................................................................................................................................................................
99 interface Solver 102 interface Solver
100 { 103 {
101 // this(in Game g); 104 // this(in Game g);
102 char single_step(); 105 char single_step();
103 void force(char c); 106 void force(char c);
104 } 107 }
105 108
106 class Solver_0 : Solver | 109 class 不動如山 : Solver
107 { 110 {
108 this(in Game g) {} 111 this(in Game g) {}
109 char single_step() { return 'W'; } 112 char single_step() { return 'W'; }
110 void force(char c) {} 113 void force(char c) {}
111 } 114 }
112 115
113 class Solver_1 : Solver | 116 class 徐如林 : Solver
114 { 117 {
115 int wait_count = 0; 118 int wait_count = 0;
116 int choke_count = 0; 119 int choke_count = 0;
117 120
118 Game g; 121 Game g;
119 this(in Game g) 122 this(in Game g)
120 { 123 {
................................................................................................................................................................................
387 } 390 }
388 return []; 391 return [];
389 } 392 }
390 return (danger_ok ? [] : tryA()) ~ tryB() ~ tryC(); 393 return (danger_ok ? [] : tryA()) ~ tryB() ~ tryC();
391 } 394 }
392 } 395 }
393 396
394 class Solver_2(SubSolver) : Solver | 397 class 侵掠如火(SubSolver) : Solver
395 { 398 {
396 // Parameters. 399 // Parameters.
397 int PredictFuture = 10; 400 int PredictFuture = 10;
398 const string[] RandomChoicePattern; // PF*RCP exhaustive search for RL s 401 const string[] RandomChoicePattern; // PF*RCP exhaustive search for RL s
399 const ReplanLength = 400; // O(PF*RCP*RL*SubSolver.single_step 402 const ReplanLength = 400; // O(PF*RCP*RL*SubSolver.single_step
400 403
401 Game current_game; 404 Game current_game;
................................................................................................................................................................................
594 t pop() { 597 t pop() {
595 t v = cur[0]; cur = cur[1..$]; 598 t v = cur[0]; cur = cur[1..$];
596 if(cur.empty) { cur = next; next = null; } 599 if(cur.empty) { cur = next; next = null; }
597 return v; 600 return v;
598 } 601 }
599 } 602 }
600 603
601 class Solver_3 : Solver | 604 class 疾如風 : Solver
602 { 605 {
603 Game g; 606 Game g;
604 this(in Game g) 607 this(in Game g)
605 { 608 {
606 this.g = g.clone(); 609 this.g = g.clone();
607 } 610 }
608 611
................................................................................................................................................................................
661 } 664 }
662 } 665 }
663 } 666 }
664 return 'A'; 667 return 'A';
665 } 668 }
666 } 669 }
667 670
> 671 //alias 侵掠如火!(疾如風) MainSolver;
668 //alias Solver_3 MainSolver; | 672 alias 侵掠如火!(徐如林) MainSolver;
669 alias Solver_2!(Solver_1) MainSolver; | 673 //alias 疾如風 MainSolver;
670 //alias Solver_1 MainSolver; | 674 //alias 徐如林 MainSolver;
671 //alias Solver_0 MainSolver; | 675 //alias 不動如山 MainSolver;