アットウィキロゴ

pro0204

class pro0204{
public static void main(String [] args) {
int x[]=new int[16];
int y[]=new int[16];
int z[]=new int[16];
int mx[]=new int[1000];
int my[]=new int[1000];
int mz[]=new int[1000];
int gun,dgun;
int maxx,minx,miny;
int t,s,m,n;
int arrow;
int xs,ys;
int score,s1,h;
double gamble;
int t1,star;
int mode;
s=1;
for (m=8;m<11;m++){
for (n=3;n<8;n++){
x[s]=n;
y[s]=m;
z[s]=1;
s=s+1;
}
}

arrow=1;
gun=5;
t=1;
mode=0;
while(mode<50){

maxx=-999;
for (s=1;s<16;s++){
xs=-999;
if (z[s]>0)xs=x[s];
if (xs>maxx)maxx=x[s];
}

minx=999;
for (s=1;s<16;s++){
xs=999;
if (z[s]>0)xs=x[s];
if (x[s]<minx)minx=x[s];
}

if (maxx==10)arrow=-1;
if (minx==1)arrow=1;

for (s=1;s<16;s++){
if (maxx==10)y[s]=y[s]-1;
if (minx==1)y[s]=y[s]-1;
}

for (s=1;s<16;s++){
x[s]=x[s]+arrow;
}

miny=999;
for (s=1;s<16;s++){
if (y[s]<miny)miny=y[s];
}
if (miny==0)System.out.println("game over");
if (miny==0)mode=100;

gamble=Math.random();
dgun=1;
if (gamble>0.5)dgun=-1;
gun=gun+dgun;
if (gun>10)gun=10;
if (gun<1)gun=1;


mx[t]=gun;
my[t]=0;
mz[t]=1;
star=t-10;
if (star<1)star=1;
for (t1=star;t1<t;t1++){
my[t1]=my[t1]+1;
if (my[t1]==10)mz[t1]=0;
}


for (t1=star;t1<t;t1++){
for (s=1;s<16;s++){
h=0;
if (mx[t1]==x[s])h=h+1;
if (my[t1]==y[s])h=h+1;
if (mz[t1]==1)h=h+1;
if (z[s]==1)h=h+1;
if (h==4)z[s]=0;
if (h==4)mz[t1]=0;
}
}

s1=0;
for (s=1;s<16;s++){
s1=s1+z[s];
}
score=15-s1;
if (score==15)System.out.println("clear");
if (score==15)mode=100;
System.out.println(score);
t=t+1;
if (t>100)mode=100;
}



}
}
最終更新:2010年09月19日 17:45