Overview
SHA1 Hash: | 50fc08d8839826c3b915733cd6827efd45e3a0d6 |
---|---|
Date: | 2012-07-16 15:57:54 |
User: | kinaba |
Comment: | Fast solver should go towards up (since it knows nothing about water...) |
Timelines: | family | ancestors | descendants | both | trunk |
Diffs: | redesign |
Downloads: | Tarball | ZIP archive |
Other Links: | files | file ages | manifest |
Tags And Properties
- branch=trunk inherited from [16f0b5784f]
- sym-trunk inherited from [16f0b5784f]
Changes
Modified src/solver.d from [3f2a2d28b89b3fbf] to [1e2f760afef7fe9f].
613 return tuple(s, log, state); 613 return tuple(s, log, state); 614 } 614 } 615 } 615 } 616 616 617 /// 617 /// 618 /// Solver "Wind": let your rapidity be that of the wind. 618 /// Solver "Wind": let your rapidity be that of the wind. 619 /// 619 /// 620 class 疾如風 : Solver | 620 class 疾如風(bool UP) : Solver 621 { 621 { 622 Game g; 622 Game g; 623 this(in Game g) 623 this(in Game g) 624 { 624 { 625 this.g = g.clone(); 625 this.g = g.clone(); 626 } 626 } 627 627 ................................................................................................................................................................................ 689 reverse(trace); 689 reverse(trace); 690 return trace.idup; 690 return trace.idup; 691 } 691 } 692 p=q; 692 p=q; 693 } 693 } 694 } 694 } 695 695 696 int[4] dy=[-1,+1,0,0]; | 696 int[4] dy=UP ? [+1,0,0,-1] : [-1,+1,0,0]; 697 int[4] dx=[0,0,-1,+1]; | 697 int[4] dx=UP ? [0,-1,+1,0] : [0,0,-1,+1]; 698 char[] ds=['D','U','L','R']; | 698 char[] ds=UP ? ['U','L','R','D'] : ['D','U','L','R']; 699 for(int i=0; i<4; ++i) { 699 for(int i=0; i<4; ++i) { 700 if(g.map.robot==p && death.count(ds[i])) 700 if(g.map.robot==p && death.count(ds[i])) 701 continue; 701 continue; 702 int y=p.y+dy[i], x=p.x+dx[i]; 702 int y=p.y+dy[i], x=p.x+dx[i]; 703 if((g.map[y,x]==' '||g.map[y,x]=='\\'||g.map[y,x 703 if((g.map[y,x]==' '||g.map[y,x]=='\\'||g.map[y,x 704 Q.push(tuple(new Pos(y,x),p), dist+1); 704 Q.push(tuple(new Pos(y,x),p), dist+1); 705 } 705 } ................................................................................................................................................................................ 713 class Switcher 713 class Switcher 714 { 714 { 715 this(in Game g) 715 this(in Game g) 716 { 716 { 717 if(g.map.W*g.map.H <= 1600) 717 if(g.map.W*g.map.H <= 1600) 718 sub_solver = new 侵掠如火!(徐如林)(g); 718 sub_solver = new 侵掠如火!(徐如林)(g); 719 else 719 else 720 sub_solver = new 侵掠如火!(疾如風)(g); | 720 sub_solver = new 侵掠如火!(疾如風!(true))(g); 721 } 721 } 722 char single_step() { return sub_solver.single_step(); } 722 char single_step() { return sub_solver.single_step(); } 723 void force(char c) { return sub_solver.force(c); } 723 void force(char c) { return sub_solver.force(c); } 724 724 725 private Solver sub_solver; 725 private Solver sub_solver; 726 } 726 } 727 727 728 alias 侵掠如火!(疾如風) FastSolver; | 728 alias 侵掠如火!(疾如風!(false)) FastSolver; 729 729 730 //alias Switcher MainSolver; | 730 alias Switcher MainSolver; 731 //alias 侵掠如火!(疾如風) MainSolver; < 732 alias 侵掠如火!(徐如林) MainSolver; | 731 //alias 侵掠如火!(徐如林) MainSolver; 733 //alias 疾如風 MainSolver; < 734 //alias 徐如林 MainSolver; < 735 //alias 不動如山 MainSolver; <