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];
}
}
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;
}
最終更新:2015年10月06日 10:40