アットウィキロゴ

よふぉ

package sh;
 
 
 
public class two {
 
    int[] pos=new int[7];
  String[] hand=new String[7];  
 
 
String mode;
 
int number_sel;
int[] koma_sel=new int[11];
 
int[][] pos_chx=new int[101][7];
String[][] hand_chx=new String[101][7];
String[] mode_chx=new String[101];
int number_chx;
 String[] hash_chx=new String[101];
 
 
    void makedata(String hhh){
 
        decode(hhh);
 
 
 
        select_koma();
 int s;
 int[] c=new int[11];
    for(s=1;s<10;s++){
    c[s]=0;        
     }
    for(s=1;s<7;s++){
    int sx=pos[s];    
    c[sx]=100;
    }    
 
    int sx=0;
    int number;
    int[] a=new int[11];
    for(s=1;s<10;s++){
    if(c[s]>50)sx=sx+1;    
    if(c[s]>50)a[sx]=s; 
    }    
 number=sx;
 int tx=0;
    for(s=1;s<number_sel+1;s++){
    for(sx=1;sx<number+1;sx++){
    int m;
    tx=tx+1;
    for(m=1;m<7;m++){
    pos_chx[tx][m]=pos[m];   
    hand_chx[tx][m]=hand[m];
    }   
    int x3=koma_sel[s];
    pos_chx[tx][x3]=a[sx];
    mode_chx[tx]=mode; 
    }    
    }
 
    number_chx=tx;
    for(s=1;s<number_chx+1;s++){
    match(s);
    }
 
    for(s=1;s<number_chx+1;s++){
 hash_chx[s]=hash(s);
 
 }
 
    }
 
 
String hash(int q){
 
       String ha="";
       if (mode_chx[q].equals("先手"))ha=ha+"w";
       if (mode_chx[q].equals("後手"))ha=ha+"x";
       if (mode_chx[q].equals("先手勝利"))ha=ha+"y";
       if (mode_chx[q].equals("後手勝利"))ha=ha+"z";
 
       int s;
       for(s=1;s<7;s++){
       if(hand_chx[q][s].equals("先手"))ha=ha+"p";    
       if(hand_chx[q][s].equals("後手"))ha=ha+"q"; 
       }
 
       String w1="a,b,c,d,e,f,g,h,i,j";
       String[] ww=w1.split(",");
 
       for(s=1;s<7;s++){
       int sx=pos_chx[q][s];    
       ha=ha+ww[sx];
       }
 
 
        return ha; 
}
 
void decode(String hxp){
 
    String m1=hxp.substring(0,1);
    String[] h1=new String[7];
    String[] p1=new String[7];
    int s;
    for(s=1;s<7;s++){
    h1[s]=hxp.substring(s,s+1);
    }
    for(s=1;s<7;s++){
    p1[s]=hxp.substring(s+6,s+7);
    }
 
    if(m1.equals("w"))mode="先手";
    if(m1.equals("x"))mode="後手";  
    if(m1.equals("y"))mode="先手勝利";
    if(m1.equals("z"))mode="後手勝利";  
 
 
    for(s=1;s<7;s++){
    if(h1[s].equals("p"))hand[s]="先手";
    if(h1[s].equals("q"))hand[s]="後手";       
    }
 
 
    for(s=1;s<7;s++){
    if(p1[s].equals("a"))pos[s]=0;
    if(p1[s].equals("b"))pos[s]=1;       
    if(p1[s].equals("c"))pos[s]=2;
    if(p1[s].equals("d"))pos[s]=3; 
    if(p1[s].equals("e"))pos[s]=4;
    if(p1[s].equals("f"))pos[s]=5; 
    if(p1[s].equals("g"))pos[s]=6;
    if(p1[s].equals("h"))pos[s]=7; 
    if(p1[s].equals("i"))pos[s]=8;
    if(p1[s].equals("j"))pos[s]=9; 
    }
 
 
 
 
 
 
 
 
}
 
 
 
 
   void match(int q){
 
 
       String mm=mode;
       if(mm=="先手")mode_chx[q]="後手";
       if(mm=="後手")mode_chx[q]="先手";
 
       if(hand_chx[q][1]=="後手")mode_chx[q]="後手勝利";
       if(hand_chx[q][4]=="先手")mode_chx[q]="先手勝利";
 
   } 
 
 
    void select_koma(){
 
        int s,sx;
        sx=0;
        for(s=1;s<7;s++){
        int h=0;
        if(hand[s].equals(mode))h=h+1;
        if(pos[s]==0)h=h+1;
        if(h==2)sx=sx+1;
        if(h==2)koma_sel[sx]=s;
        }
 
        number_sel=sx;
 
 
    }
 
 
 
 
}
 
最終更新:2018年03月02日 10:39