アットウィキロゴ

play54

var delta = new Array();
var point_home = new Array();
var point_visit = new Array();
 
function sample() {
 
    var sub = new ex();
    sub.faststep();
    delta = sub.delta;
 
    var timer;
 
var delay = 1000;
 
 
inn = 0;
 
var loop = function () {
 
    inn = inn + 1;
    if (inn > 9) {
        for (s = 1; s < 10; s++) {
            point_home[s] = 0;
            point_visit[s] = 0;
        }
    }
 
    if (inn > 9) inn = 1;
 
    var sub2 = new ex();
    sub2.delta = delta;
    sub2.point_home = point_home;
    sub2.point_visit = point_visit;
    sub2.studio(inn);
    point_home = sub2.point_home;
    point_visit = sub2.point_visit;
 
 
    paint();
 
    clearTimeout(timer);
    timer = setTimeout(loop, delay);
}
 
loop();
 
 
}
 
function paint(){
 
str="<table>";
str=str+"<tr>";
str=str+"<td>";
str=str+"kai";
str=str+"<td>";
str=str+"<td>";
str=str+"visit";
str=str+"<td>";
str=str+"home";
str=str+"</td>";
str=str+"</tr>";
for(s=1;s<inn+1;s++){
str=str+"<tr>";
str=str+"<td>";
str=str+s;
str=str+"</td>";
str=str+"<td>";
str=str+point_visit[s];
str=str+"</td>";
str=str+"<td>";
str=str+point_home[s];
str=str+"</td>";
str=str+"</tr>";
}
str=str+"</table>";
 
 
$("#memo").html(str);
 
 
 
 
}
 
class ex{
 
delta:number[]=new Array();
base:number[]=new Array();
point:number;
point_home:number[]=new Array();
point_visit:number[]=new Array();
 
faststep():void{
 
var s:number;
 
for(s=1;s<51;s++){
this.delta[s]=0;
}
 
for(s=51;s<71;s++){
this.delta[s]=1;
}
 
for(s=71;s<80;s++){
this.delta[s]=2;
}
 
for(s=81;s<90;s++){
this.delta[s]=3;
}
for(s=91;s<101;s++){
this.delta[s]=4;
}
 
 
 
 
}
 
 
studio(inn:number):void{
 
this.game();
this.point_visit[inn]=this.point;
this.game();
this.point_home[inn]=this.point;
 
}
 
game():void{
 
var out:number;
var s:number;
 
for(s=1;s<4;s++){
this.base[s]=0;
}
 
out=0;
this.point=0;
while(out<2.5){
var g:number;
 
g=this.hit();
 
if(g==0)out=out+1;
if(g==1)this.play();
if(g==2)this.play2();
if(g==3)this.play3();
if(g==4)this.play4();
}
 
 
 
}
 
play():void{
 
if(this.base[3]==1)this.point=this.point+1;
if(this.base[3]==1)this.base[3]=0;
if(this.base[2]==1)this.base[3]=1;
if(this.base[2]==1)this.base[2]=0;
if(this.base[1]==1)this.base[2]=1;
this.base[1]=1;
 
}
 
 
play2():void{
 
if(this.base[3]==1)this.point=this.point+1;
if(this.base[3]==1)this.base[3]=0;
if(this.base[2]==1)this.point=this.point+1;
if(this.base[2]==1)this.base[2]=0;
if(this.base[1]==1)this.base[3]=1;
if(this.base[1]==1)this.base[1]=0;
 
this.base[2]=1;
 
}
 
play3():void{
 
if(this.base[3]==1)this.point=this.point+1;
if(this.base[3]==1)this.base[3]=0;
if(this.base[2]==1)this.point=this.point+1;
if(this.base[2]==1)this.base[2]=0;
if(this.base[1]==1)this.point=this.point+1;
if(this.base[1]==1)this.base[1]=0;
 
this.base[3]=1;
 
}
 
play4():void{
 
if(this.base[3]==1)this.point=this.point+1;
if(this.base[3]==1)this.base[3]=0;
if(this.base[2]==1)this.point=this.point+1;
if(this.base[2]==1)this.base[2]=0;
if(this.base[1]==1)this.point=this.point+1;
if(this.base[1]==1)this.base[1]=0;
 
this.point=this.point+1;
 
}
 
 
hit():number{
 
var n1:number;
var n2:number;
var m1:number;
 
n1=100*Math.random();
n2=Math.floor(n1)+1;
m1=this.delta[n2];
return m1;
}
}
 
最終更新:2015年10月02日 16:41