アットウィキロゴ

さい

package ph;
 
 
public class pro {
 
 
    int[] c=new int[11];
     int[] y=new int[11];
    int[] dc=new int[11];
     int[] dy=new int[11];
     int s,th;
 
 
    public static void main(String[] args) {
        pro test=new pro();
    }
 
    pro(){
 
   th=100;
 
    for(s=1;s<11;s++){
    c[s]=40;
    y[s]=60;
    dc[s]=0;
    dy[s]=0;
    }
 
    for(s=1;s<11;s++){
    c[s]=c[s]+dc[s];
    y[s]=y[s]+dy[s];
    if(c[s]<1)c[s]=1;
    if(y[s]<0)y[s]=0;
    if(y[s]>th-1)y[s]=th-1;
    }
 
 
 
 
 
 
}
void change(int s){
    int sx;
    double m1,minm;
    minm=9999;
 for(sx=1;sx<11;sx++){
 m1=(c[sx]-c[s])*(c[sx]-c[s])+(y[sx]-y[s])*(y[sx]-y[s]);   
if(s==sx)m1=9999;
if(m1<minm)minm=m1;
} 
 double p1,p2;
p1=0.2; 
if(minm>100)p1=0.8;
if(minm<4)p1=0.8;
p2=Math.random();
if(p2<p1)select(s);
 
}
void select(int s){
 
int b1;
double w1,uc,uy,du;
b1=bud();
w1=wel();
uc=u(c[s]+1,y[s],th)-u(c[s],y[s],th);
uy=u(c[s],y[s]-1,th)-u(c[s],y[s],th);
du=(uc+uy)/2;
 
double p1,p2;
int ch;
ch=1;
if(b1<0)ch=ch-1;
if(du<w1)ch=ch-1;
p1=0;
if(ch==1)p1=0.1;
if(ch==0)p1=0.5;
if(ch==0)p1=0.9;
 
p2=Math.random();
 
if(p1>p2)play_a(s);
if(p2<p1)play_b(s);    
 
}
void play_a(int s){
 
 
}
 
void play_b(int s){
 
 
}
double wel(){    
int s;
double w1,uc,uy;
w1=0;
for(s=1;s<11;s++){
uc=u(c[s]+1,y[s],th)-u(c[s],y[s],th);
uy=u(c[s],y[s]-1,th)-u(c[s],y[s],th);
w1=w1+uc+uy;    
}
w1=w1/20;
return w1;    
}
int bud(){
int s,b1;
b1=0;
for(s=1;s<11;s++){
b1=b1+y[s]-c[s];    
}
return b1;
}
double u(int c1,int y1,int th1){
double delta,u1;
delta=0.01;
u1=Math.log(c1*delta)+Math.log(1-(double)y1/th1);
return u1;
}
}
最終更新:2014年04月13日 14:11