アットウィキロゴ

tred

class ex{
 
ax:number[]=new Array();
ay:number[]=new Array();
bx:number[]=new Array();
by:number[]=new Array();
b:number[]=new Array();
a:number[]=new Array();
dx:number;
dy:number;
 
faststep():void{
 
var s:number;
 
for(s=1;s<11;s++){
this.a[s]=100;
this.b[s]=100;
this.ay[s]=1;
this.ax[s]=s;
this.by[s]=10;
this.bx[s]=s;
} 
 
 
 
}
 
 move_a():void{
 
var s,x1,y1,ch:number;
 
for(s=1;s<11;s++){
this.dir();
x1=this.ax[s]+this.dx;
y1=this.ay[s]+this.dy;
ch=this.check_a(x1,y1);
if(ch<50)this.ay[s]=y1;    
if(ch<50)this.ax[s]=x1;   
alert(ch+","+x1+","+y1);
}
 
 
}
 
 
dir():void{
 
var n1,n2:number;
 
n1=4*Math.random();
n2=Math.floor(n1)+1;
 
this.dx=0;
this.dy=0;
if(n2==1)this.dx=1;
if(n2==1)this.dy=0;
if(n2==2)this.dx=-1;
if(n2==2)this.dy=0;
if(n2==3)this.dx=0;
if(n2==3)this.dy=1;
if(n2==4)this.dx=0;
if(n2==4)this.dy=-1;
}
 
 check_a(px:number,py:number):number{
 
 var sx,y1,ch,h:number;
 
ch=0;
for(sx=1;sx<11;sx++){
h=0;
if(this.bx[sx]==px)h=h+1;
if(this.by[sx]==py)h=h+1;   
if(this.b[sx]>50)h=h+1;  
if(h==3)ch=100;
}
 
for(sx=1;sx<11;sx++){
h=0;
if(this.ax[sx]==px)h=h+1;
if(this.ay[sx]==py)h=h+1;   
if(this.a[sx]>50)h=h+1;  
if(h==3)ch=100;
}
 
if(px<1)ch=100;
if(py<1)ch=100;
if(px>10)ch=100;
if(py>10)ch=100;
 
return ch;
} 
 
}
 
最終更新:2016年11月18日 04:04