Simple GIS

GISプログラムの練習

コンビニの基本

package shop;


public class pro {

    int shop=new int[501];
  int s,shopnumber;
     int area=new int[501];
  int n;
   double p=new double[501]; 
  
  int subnumber;
  int card=new int[10];
     
  int s1,s2;
  
    public static void main(String args) {
        pro test=new pro();
    }

 pro(){

     shopnumber=500;
     
     for(s=1;s<shopnumber+1;s++){
     shop[s]=0;
     }
     
     
     for(s=1;s<shopnumber+1;s++){
     n=(int)(10*Math.random())+1;
     area[s]=n;
     }
     
     
shuffle();

s1=2;
s2=card[s1];
shop[s2]=1;

shuffle();

s1=3;
s2=card[s1];
shop[s2]=2;




}
 
 
 
void shuffle(){

    int s,sx;
   int sub=new int[501];
  
    sx=0;
for(s=1;s<shopnumber+1;s++){
if(shop[s]==0)sx=sx+1;
 if(shop[s]==0)sub[sx]=s;    
}
subnumber=sx;        
    
for(s=1;s<subnumber+1;s++){
p[s]=Math.random();
}

ranking();
    
}

void ranking(){
int s,sx,r;
int[] ch=new int[30000];
int h;
double maxp;
for(r=1;r<6;r++){
maxp=0;
sx=0;
for(s=1;s<subnumber+1;s++){
h=0;
if(p[s]>maxp)h=h+1;
if(ch[s]<60)h=h+1;
if(h==2)maxp=p[s];
if(h==2)sx=s;
}
card[r]=sx;
ch[sx]=100;
}



}



}