アットウィキロゴ

じゃヴぁ0221

class game0221{
public static void main(String [] args) {
int x,dx,xmode;
int y,dy,ymode;

int coin;
int h;
int t;
x=60;
xmode=0;
y=40;
ymode=0;

t=0;
while(t<100){

coin=seekcoin();
dx=0;

if(xmode>0)xmode=xmode+1;
if(xmode==4)xmode=0;

h=0;
if (coin==2)h=h+1;
if (xmode==0)h=h+1;
if(h==2)dx=1;

h=0;
if (coin==3)h=h+1;
if (xmode==0)h=h+1;
if(h==2)dx=-1;

x=x+dx;

h=0;
if (coin==4)h=h+1;
if (xmode==0)h=h+1;
if(h==2)xmode=1;

coin=seekcoin();
dy=0;

if(ymode>0)ymode=ymode+1;
if(ymode==4)ymode=0;

h=0;
if (coin==2)h=h+1;
if (ymode==0)h=h+1;
if(h==2)dy=1;
h=0;
if (coin==3)h=h+1;
if (ymode==0)h=h+1;
if(h==2)dy=-1;

y=y+dy;

h=0;
if (coin==4)h=h+1;
if (ymode==0)h=h+1;
if(h==2)ymode=1;

h=0;
if(xmode==2)h=h+1;
if(ymode==2)h=0;
if(x-y<20)h=h+1;
if(h==2)t=1000;

h=0;
if(ymode==2)h=h+1;
if(xmode==2)h=0;
if(x-y<20)h=h+1;
if(h==2)t=1000;

System.out.println(xmode);
System.out.println(ymode);
t=t+1;
}





}

public static int seekcoin(){
double p;
int c;
p=Math.random();
c=1;
if(p>0.25)c=2;
if(p>0.5)c=3;
if(p>0.75)c=4;
return c;
}

}
最終更新:2011年02月16日 05:46