アットウィキロゴ

sw

package u2;
 
 
public class pro {
 
 int[] th=new int[11];
  double delta;
  int c1,y1;  
  int s,sx,b1;
  double u1;
  double[][][] u=new double[3][11][11];  
  double[][] sig=new double[3][11];  
  int[][] opc=new int[3][11];
  int[][] opy=new int[3][11];
 
    public static void main(String[] args) {
        pro test=new pro();
    }
   pro(){ 
 
       th[1]=100;
th[2]=80;
 
    delta=0.01;
    c1=50;
    y1=50;
 
    for(s=-5;s<6;s++){
    for(sx=-5;sx<6;sx++){
    u1=u(c1+s,y1+sx,th[1]);
    setu(1,s,sx,u1);
    }}
 
     for(s=-5;s<6;s++){
    for(sx=-5;sx<6;sx++){
    u1=u(c1+s,y1+sx,th[2]);
    setu(2,s,sx,u1);
    }}
 
    int h;
 
    double u2,maxu;
  for(b1=-5;b1<6;b1++){
  maxu=-999;
  c1=0;
  y1=0;
  for(s=-5;s<6;s++){
  sx=b1-s;
  h=0;
  if(sx>-6)h=h+1;
  if(sx<6)h=h+1;
  u2=-999;
  if(h==2)u2=getu(1,s,sx);
  if(u2>maxu)c1=s;
  if(u2>maxu)y1=sx;
  if(u2>maxu)maxu=u2;
  }
  setsig(1,b1,maxu);
  setc(1,b1,c1);
  sety(1,b1,y1);
  }  
 
   for(b1=-5;b1<6;b1++){
  maxu=-999;
  c1=0;
  y1=0;
  for(s=-5;s<6;s++){
  sx=b1-s;
  h=0;
  if(sx>-6)h=h+1;
  if(sx<6)h=h+1;
  u2=-999;
  if(h==2)u2=getu(2,s,sx);
  if(u2>maxu)c1=s;
  if(u2>maxu)y1=sx;
  if(u2>maxu)maxu=u2;
  }
  setsig(2,b1,maxu);
  setc(2,b1,c1);
  sety(2,b1,y1);
  }  
 
 
 
 
 
 
 
 
   }
 double getu(int th1,int c1,int y1){
    int s1,s2;
    s1=c1+5;
    s2=y1+5;
  return u[th1][s1][s2];
  } 
 
  int gety(int th1,int b1){
    int s1,s2;
    s1=b1+5;
  return opy[th1][s1];
  }
 
   int getc(int th1,int b1){
    int s1,s2;
    s1=b1+5;
  return opc[th1][s1];
  } 
    void setu(int th1,int c1,int y1,double u1){
    int s1,s2;
    s1=c1+5;
    s2=y1+5;
   u[th1][s1][s2]=u1;
  }
 
     void setc(int th1,int b1,int c1){
    int s1,s2;
    s1=b1+5;
   opc[th1][s1]=c1;
  }
 
     void sety(int th1,int b1,int y1){
    int s1,s2;
    s1=b1+5;
   opy[th1][s1]=y1;
  } 
 
 
     void setsig(int th1,int b1,double u1){
    int s1,s2;
    s1=b1+5;
   sig[th1][s1]=u1;
  }
 
 
     double getsig(int th1,int b1){
    int s1,s2;
    s1=b1+5;
   return sig[th1][s1];
  }
 
double u(int c1,int y1,int th1){
double c2,x2,u1,z;
z=0;
c2=c1*delta;
x2=1-(double)y1/th1;    
if(x2<0.01)x2=2;
u1=Math.log(c2)+Math.log(x2);
if(x2>1)u1=-999;
return u1;
}
 
 
}
 
最終更新:2014年05月31日 16:37