アットウィキロゴ

skl

package easing;
 
 
public class pro {
 
    int[][] sig=new int[11][11];
    double p;
int s,sx;
int t;    
double[][] q=new double[3][3];
 
 
    public static void main(String[] args) {
        pro test=new pro();
    }
 
 
    pro(){
 
 
    for(s=1;s<11;s++){    
    for(sx=1;sx<11;sx++){  
    p=Math.random();
    sig[s][sx]=1;
    if(p>0.5)sig[s][sx]=-1;    
    }    
    }   
 
    int s1,s2;    
int y1,x1,z;
int z1,h;    
 
for(t=1;t<101;t++){
 
z1=0;
    for(s=1;s<11;s++){    
    for(sx=1;sx<11;sx++){ 
    for(s1=-1;s1<2;s1++){    
    for(s2=-1;s2<2;s2++){ 
    y1=s+s1;
    x1=sx+s2;
    z=0;
    if(x1>10)z=100;
    if(x1<1)z=100;
    if(y1>10)z=100;
    if(y1<1)z=100;  
    if(z>50)x1=5;
    if(z>50)y1=5;
    h=0;
    if(s==y1)h=h+1;
    if(sx==x1)h=h+1;
    if(h==2)z=100;
    if(z<50)z1=z1+sig[s][sx]*sig[x1][y1];
    }
    }   
    }
    }
 
 
 
    for(s=1;s<11;s++){    
    for(sx=1;sx<11;sx++){ 
    z1=z1+sig[s][sx];
    }
    }
 
 
    System.out.println(z1);
 
    for(s=1;s<11;s++){    
    for(sx=1;sx<11;sx++){ 
    sig[s][sx]=trial(sig[s][sx]);
    }
    }
 
 
}
 
 
 
    }
int trial(int s){
double p1;
int h;
int s1;
p1=Math.random();    
s1=s;
h=0;
if(p1<0.01)h=h+1;
if(s==1)h=h+1;
if(h==2)s1=-1;
h=0;
if(p1<0.001)h=h+1;
if(s==-1)h=h+1;
if(h==2)s1=1;
return s1;
}
}
 
最終更新:2014年03月25日 09:07