Check-in [50fc08d883]
Not logged in
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
Changes

Modified src/solver.d from [3f2a2d28b89b3fbf] to [1e2f760afef7fe9f].

613 613 return tuple(s, log, state); 614 614 } 615 615 } 616 616 617 617 /// 618 618 /// Solver "Wind": let your rapidity be that of the wind. 619 619 /// 620 -class 疾如風 : Solver 620 +class 疾如風(bool UP) : Solver 621 621 { 622 622 Game g; 623 623 this(in Game g) 624 624 { 625 625 this.g = g.clone(); 626 626 } 627 627 ................................................................................ 689 689 reverse(trace); 690 690 return trace.idup; 691 691 } 692 692 p=q; 693 693 } 694 694 } 695 695 696 - int[4] dy=[-1,+1,0,0]; 697 - int[4] dx=[0,0,-1,+1]; 698 - char[] ds=['D','U','L','R']; 696 + int[4] dy=UP ? [+1,0,0,-1] : [-1,+1,0,0]; 697 + int[4] dx=UP ? [0,-1,+1,0] : [0,0,-1,+1]; 698 + char[] ds=UP ? ['U','L','R','D'] : ['D','U','L','R']; 699 699 for(int i=0; i<4; ++i) { 700 700 if(g.map.robot==p && death.count(ds[i])) 701 701 continue; 702 702 int y=p.y+dy[i], x=p.x+dx[i]; 703 703 if((g.map[y,x]==' '||g.map[y,x]=='\\'||g.map[y,x]=='.'||g.map[y,x]=='O'||g.map[y,x]=='!')&&!V[y][x]) { 704 704 Q.push(tuple(new Pos(y,x),p), dist+1); 705 705 } ................................................................................ 713 713 class Switcher 714 714 { 715 715 this(in Game g) 716 716 { 717 717 if(g.map.W*g.map.H <= 1600) 718 718 sub_solver = new 侵掠如火!(徐如林)(g); 719 719 else 720 - sub_solver = new 侵掠如火!(疾如風)(g); 720 + sub_solver = new 侵掠如火!(疾如風!(true))(g); 721 721 } 722 722 char single_step() { return sub_solver.single_step(); } 723 723 void force(char c) { return sub_solver.force(c); } 724 724 725 725 private Solver sub_solver; 726 726 } 727 727 728 -alias 侵掠如火!(疾如風) FastSolver; 728 +alias 侵掠如火!(疾如風!(false)) FastSolver; 729 729 730 -//alias Switcher MainSolver; 731 -//alias 侵掠如火!(疾如風) MainSolver; 732 -alias 侵掠如火!(徐如林) MainSolver; 733 -//alias 疾如風 MainSolver; 734 -//alias 徐如林 MainSolver; 735 -//alias 不動如山 MainSolver; 730 +alias Switcher MainSolver; 731 +//alias 侵掠如火!(徐如林) MainSolver;