アットウィキロゴ

えx987

var a=new Array();
var c=new Array();
var count_h=new Array();
var count_v=new Array();
 
 
var number;
var point_h = new Array();
var point_v = new Array();
var base = new Array();
var inn, home, number_h, number_v;
 
 
function sample() {
 
        var query = "SELECT * FROM " +
            '1A5QolQncypfPERmNon9fp_ZtJ_ro5lhyi4yZHtaU';
        var encodedQuery = encodeURIComponent(query);
 
        var url = ['https://www.googleapis.com/fusiontables/v1/query'];
        url.push('?sql=' + encodedQuery);
        url.push('&key=AIzaSyAH0WCAXRIdHdbI-6bnMSN4kVDDZZmGyqY');
        url.push('&callback=?');
 
 
 
        $.ajax({
            url: url.join(''),
            dataType: 'jsonp',
            success: function (data) {
                var rows = data['rows'];
 
                for (s = 1; s < 500; s++) {
                    a[s] = new Array();
                }
 
                sx = 0;
 
                for (var i in rows) {
                    sx = sx + 1;
                    c[sx] = rows[i][0];
                    for (s = 1; s < 140; s++) {
                        a[sx][s] = rows[i][s];
                    }
 
 
                }
 
                number = sx;
 
                var code_h = new Array();
                var code_v = new Array();
                var delta_h = new Array();
                var delta_v = new Array();
 
                code_h[1] = "c1";
                code_h[2] = "c2";
                code_h[3] = "c3";
                code_h[4] = "c4";
                code_h[5] = "c5";
                code_h[6] = "c6";
                code_h[7] = "c7";
                code_h[8] = "c8";
                code_h[9] = "c9";
 
                code_v[1] = "c10";
                code_v[2] = "c11";
                code_v[3] = "c12";
                code_v[4] = "c13";
                code_v[5] = "c14";
                code_v[6] = "c15";
                code_v[7] = "c16";
                code_v[8] = "c17";
                code_v[9] = "c18";
 
 
                for (s = 1; s < 10; s++) {
                    for (sx = 1; sx < number + 1; sx++) {
                        if (c[sx] == code_h[s]) delta_h[s] = sx;
                    }
                }
 
                for (s = 1; s < 10; s++) {
                    for (sx = 1; sx < number + 1; sx++) {
                        if (c[sx] == code_v[s]) delta_v[s] = sx;
                    }
                }
 
                for (s = 1; s < 10; s++) {
                    count_h[s] = new Array();
                    count_v[s] = new Array();
                }
 
 
 
                for (s = 1; s < 10; s++) {
                    s1 = delta_h[s];
                    for (sx = 1; sx < 140; sx++) {
 
                        count_h[s][sx] = a[s1][sx];
 
                    }
                }
 
 
                for (s = 1; s < 10; s++) {
                    s1 = delta_v[s];
                    for (sx = 1; sx < 140; sx++) {
 
                        count_v[s][sx] = a[s1][sx];
 
                    }
                }
 
 
                var cx = new Array();
                for (s = 1; s < 10; s++) {
 
                    for (sx = 1; sx < 140; sx++) {
                        cx[sx] = count_h[s][sx];
                    }
 
                    var sub21 = new ball();
                    sub21.point = cx;
                    sub21.change();
                    cx = sub21.count;
 
                    for (sx = 1; sx < 12; sx++) {
                        count_h[s][sx] = cx[sx];
                    }
 
                }
 
 
 
                for (s = 1; s < 10; s++) {
 
                    for (sx = 1; sx < 140; sx++) {
                     cx[sx] = count_v[s][sx];
                    }
 
                    var sub22 = new ball();
                    sub22.point = cx;
                    sub22.change();
                    cx = sub22.count;
 
                    for (sx = 1; sx < 12; sx++) {
                        count_v[s][sx] = cx[sx];
                    }
 
                }
 
 
 
                for (s = 1; s < 10; s++) {
                    point_h[s] = 0;
                    point_v[s] = 0;
                }
 
                inn = 1;
                out = 0;
                number_h = 1;
                number_v = 1;
                home = 1;
                point = 0;
 
                base[1] = 0;
                base[2] = 0;
                base[3] = 0;
 
 
 
 
 
 
                var timer;
                var delay = 1000;
 
                var loop = function () {
 
                    var sub = new ex();
                    sub.point_h = point_h;
                    sub.point_v = point_v;
                    sub.inn = inn;
                    sub.out = out;
                    sub.home = home;
                    sub.base = base;
                    sub.point = point;
                    sub.count_h = count_h;
                    sub.count_v = count_v;
                    sub.number_h = number_h;
                    sub.number_v = number_v;
                    sub.game();
                    point_h = sub.point_h;
                    point_v = sub.point_v;
                    inn = sub.inn;
                    out = sub.out;
                    home = sub.home;
                    base = sub.base;
                    number_h = sub.number_h;
                    number_v = sub.number_v;
                    point = sub.point;
 
 
                    if (home == 1) $("#memo").html(inn + "回表" + number_v + "番" + out + "out");
                    if (home == 2) $("#memo").html(inn + "回裏" + number_h + "番" + out + "out");
                    var str = "ABC";
 
                    if (base[1] == 1) str = str + "x";
                    if (base[2] == 1) str = str + "x";
                    if (base[3] == 1) str = str + "x";
                    $("#point").html(str);
 
                    str = "<table>";
                    for (s = 1; s < inn + 1; s++) {
                        str = str + "<tr>";
                        str = str + "<td>";
                        str = str + point_v[s]
                        str = str + "</td>";
                        str = str + "<td>";
                        str = str + point_h[s]
                        str = str + "</td>";
                        str = str + "</tr>";
                    }
                    str = str + "</table>";
 
 
                    $("#p3").html(str);
 
                    if (inn > 9) refresh();
 
                    clearTimeout(timer);
                    timer = setTimeout(loop, delay);
                }
 
                loop();
 
 
 
 
 
 
 
 
 
            }
        });
 
}
 
 
function refresh(){
 
     inn = 1;
  out = 0;
  number_h = 1;
  number_v = 1;
  home = 1;
  point = 0;
 
  base[1] = 0;
  base[2] = 0;
  base[3] = 0;
 
}
 
 
class ex{
 
base:number[]=new Array();
inn:number;
out:number;
home:number;
num:number;  
count:number[]=new Array();
count_h:any[]=new Array();
count_v:any[]=new Array();
 
point:number;
point_h:number[]=new Array();
point_v:number[]=new Array();
hit:number;
number_v:number;
number_h:number;
 
 
game():void{
 
 
if(this.home==2)this.num=this.number_h;
if(this.home==1)this.num=this.number_v;
 
var s:number;
 
for(s=1;s<12;s++){
if(this.home==2)this.count[s]=this.count_h[this.num][s];
if(this.home==1)this.count[s]=this.count_v[this.num][s];
}
 
this.box();
 
if(this.hit==1)this.one();
if(this.hit==2)this.two();
if(this.hit==3)this.three();
if(this.hit==4)this.four();
if(this.hit==5)this.one();
if(this.hit==6)this.swing();
if(this.hit==7)this.step();
if(this.hit==8)this.swing();
if(this.hit==9)this.swing();
if(this.hit==10)this.swing();
if(this.hit==11)this.swing(); 
 
this.num=this.num+1;
if(this.num>9)this.num=1;
 
if(this.home==2)this.number_h=this.num;
if(this.home==1)this.number_v=this.num;
 
 
if(this.out>2.5)this.change();
 
 
 
}
 
change():void{
 
if(this.home==1)this.point_v[this.inn]=this.point;
if(this.home==2)this.point_h[this.inn]=this.point;
 
this.point=0;
 
this.home=this.home+1;
if(this.home>2)this.inn=this.inn+1;
if(this.home>2)this.home=1;
this.out=0;
this.base[1]=0;
this.base[2]=0;
this.base[3]=0;
 
 
 
 
 
 
 
}
 
 
one():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;
 
}
 
 
two():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;
 
}
 
three():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;
 
}
 
four():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;
 
}
 
 
  swing():void{
 
 this.out=this.out+1;
 
  }
 
 
 step():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;    
  if(this.base[1]==1)this.base[1]=0;
 
  this.out=this.out+1;
 
 
  }
 
 
box():void{
 
var n1:number;
var s:number;
var c:number[]=new Array(); 
var h:number;
 
c[0]=0;
for(s=1;s<12;s++){
c[s]=c[s-1]+this.count[s];
}
 
n1=c[11]*Math.random();
 
this.hit=1;
for(s=1;s<12;s++){
h=0;
if(n1<c[s])h=h+1;
if(n1>c[s-1])h=h+1;
if(h==2)this.hit=s;
}
 
 
}
}
 
class ball{
 
namex:string[]=new Array();
b:string[]=new Array();
point:number[]=new Array();
count:number[]=new Array();
 
change():void{
 
this.namex[1]="空三振";
this.namex[2]="左飛";
this.namex[3]="投ゴロ";
this.namex[4]="右飛";
this.namex[5]="見逃三";
this.namex[6]="三ゴロ";
this.namex[7]="二ゴロ";
this.namex[8]="中飛";
this.namex[9]="中安";
this.namex[10]="左線二";
this.namex[11]="遊ゴロ";
this.namex[12]="右本";
this.namex[13]="左安";
this.namex[14]="右安";
this.namex[15]="三安";
this.namex[16]="捕ゴロ";
this.namex[17]="四球";
this.namex[18]="遊併殺";
this.namex[19]="左中二";
this.namex[20]="二飛";
this.namex[21]="捕邪飛";
this.namex[22]="一ゴロ";
this.namex[23]="死球";
this.namex[24]="一犠打";
this.namex[25]="右線二";
this.namex[26]="投犠打";
this.namex[27]="右中二";
this.namex[28]="三飛";
this.namex[29]="一邪飛";
this.namex[30]="遊直";
this.namex[31]="二ゴ失";
this.namex[32]="一安";
this.namex[33]="二併殺";
this.namex[34]="右邪飛";
this.namex[35]="一飛";
this.namex[36]="中本";
this.namex[37]="捕野犠打";
this.namex[38]="右邪犠";
this.namex[39]="左邪飛";
this.namex[40]="右犠飛";
this.namex[41]="一直";
this.namex[42]="遊飛";
this.namex[43]="二安";
this.namex[44]="三邪飛";
this.namex[45]="二直";
this.namex[46]="左本";
this.namex[47]="三ゴ失";
this.namex[48]="投安";
this.namex[49]="三併殺";
this.namex[50]="捕犠打";
this.namex[51]="遊安";
this.namex[52]="右中本";
this.namex[53]="敬遠";
this.namex[54]="一ゴ失";
this.namex[55]="三直";
this.namex[56]="右越三";
this.namex[57]="投犠野";
this.namex[58]="右線安";
this.namex[59]="遊ゴ失";
this.namex[60]="左越二";
this.namex[61]="遊邪飛";
this.namex[62]="左犠飛";
this.namex[63]="投直";
this.namex[64]="右越二";
this.namex[65]="中越三";
this.namex[66]="三振";
this.namex[67]="捕飛";
this.namex[68]="中越二";
this.namex[69]="投バ併打";
this.namex[70]="左中本";
this.namex[71]="左越安";
this.namex[72]="右二";
this.namex[73]="投併殺";
this.namex[74]="中二";
this.namex[75]="中犠飛";
this.namex[76]="捕犠失";
this.namex[77]="一野選";
this.namex[78]="左線安";
this.namex[79]="投ゴ失";
this.namex[80]="右越安";
this.namex[81]="遊野選";
this.namex[82]="中飛失";
this.namex[83]="逃三振";
this.namex[84]="右中三";
this.namex[85]="左飛失";
this.namex[86]="右線三";
this.namex[87]="捕安";
this.namex[88]="規違反";
this.namex[89]="左二";
this.namex[90]="一併殺";
this.namex[91]="中ゴロ";
this.namex[92]="二邪飛";
this.namex[93]="左中三";
this.namex[94]="三犠打";
this.namex[95]="投犠失";
this.namex[96]="一犠失";
this.namex[97]="投飛";
this.namex[98]="捕併殺";
this.namex[99]="捕ゴ失";
this.namex[100]="二犠打";
this.namex[101]="三野選";
this.namex[102]="三直球失";
this.namex[103]="一直球失";
this.namex[104]="中越安";
this.namex[105]="投野選";
this.namex[106]="遊飛失";
this.namex[107]="右飛失";
this.namex[108]="三飛失";
this.namex[109]="捕守備妨";
this.namex[110]="三二塁打";
this.namex[111]="投邪飛";
this.namex[112]="二犠飛";
this.namex[113]="二飛失";
this.namex[114]="左線三";
this.namex[115]="中三";
this.namex[116]="右三";
this.namex[117]="一邪直";
this.namex[118]="右ゴロ";
this.namex[119]="投飛失";
this.namex[120]="左越三";
this.namex[121]="一野犠打";
this.namex[122]="二直球失";
this.namex[123]="二野選";
this.namex[124]="遊直球失";
this.namex[125]="遊妨安打";
this.namex[126]="三犠失";
this.namex[127]="一二塁打";
this.namex[128]="打撃妨";
this.namex[129]="遊ゴロ ";
this.namex[130]="見三振";
this.namex[131]="捕失";
this.namex[132]="遊ゴロ ";
this.namex[133]="左邪犠";
this.namex[134]="投二塁打";
this.namex[135]="三邪直";
this.namex[136]="一犠失策";
this.namex[137]="二併打失";
this.namex[138]="捕飛失";
this.namex[139]="投犠失策";
 
var s:number;
 
for(s=1;s<140;s++){
if(this.namex[s].indexOf("ゴロ")>-1)this.b[s]="goro";
}
 
for(s=1;s<140;s++){
if(this.namex[s].indexOf("飛")>-1)this.b[s]="fly";
}
 
for(s=1;s<140;s++){
if(this.namex[s].indexOf("直")>-1)this.b[s]="fly";
}
 
for(s=1;s<140;s++){
if(this.namex[s].indexOf("安")>-1)this.b[s]="b1";
}
 
for(s=1;s<140;s++){
if(this.namex[s].indexOf("本")>-1)this.b[s]="b4";
 }
 
for(s=1;s<140;s++){
if(this.namex[s].indexOf("犠")>-1)this.b[s]="step";
}
 
for(s=1;s<140;s++){
if(this.namex[s].indexOf("併")>-1)this.b[s]="dout";
}
 
for(s=1;s<140;s++){
if(this.namex[s].indexOf("飛失")>-1)this.b[s]="fail";
if(this.namex[s].indexOf("捕守備妨")>-1)this.b[s]="other";
if(this.namex[s].indexOf("打撃妨")>-1)this.b[s]="fail";
}
 
 
for(s=1;s<140;s++){
if(this.namex[s].indexOf("四球")>-1)this.b[s]="ball";
if(this.namex[s].indexOf("死球")>-1)this.b[s]="ball";
if(this.namex[s].indexOf("敬遠")>-1)this.b[s]="ball";
if(this.namex[s].indexOf("三振")>-1)this.b[s]="swing";
if(this.namex[s].indexOf("二塁打")>-1)this.b[s]="b2";
if(this.namex[s].indexOf("野選")>-1)this.b[s]="fail";
}
 
for(s=1;s<140;s++){
if(this.namex[s].indexOf("失")>-1)this.b[s]="fail";
}
 
for(s=1;s<140;s++){
if(this.namex[s].indexOf("見逃三")>-1)this.b[s]="swing";
}
 
var h:number;
 
for(s=1;s<140;s++){
h=0;
if(this.b[s]=="")h=h+1;
if(this.namex[s].indexOf("二")>-1)h=h+1;
if(h==2)this.b[s]="b2";
h=0;
if(this.b[s]=="")h=h+1;
if(this.namex[s].indexOf("三")>-1)h=h+1;
if(h==2)this.b[s]="b3";
if(this.b[s]=="")this.b[s]="other";
}
 
for(s=1;s<12;s++){
this.count[s]=0;
}
 
var sx:number;
 
 
for(s=1;s<141;s++){
sx=0;
if(this.b[s]=="b1")sx=1;
if(this.b[s]=="b2")sx=2;
if(this.b[s]=="b3")sx=3;
if(this.b[s]=="b4")sx=4;
if(this.b[s]=="ball")sx=5;
if(this.b[s]=="swing")sx=6;
if(this.b[s]=="fly")sx=7;
if(this.b[s]=="goro")sx=8;
if(this.b[s]=="fail")sx=9;
if(this.b[s]=="dout")sx=10;
if(this.b[s]=="step")sx=11;
this.count[sx]=this.count[sx]+1*this.point[s];
}
 
 
 
}
 
 
}
 
最終更新:2015年10月06日 11:46