アットウィキロゴ

パチンコ88

var ball = new Array();
var bx = new Array();
var by = new Array();
var dx = new Array();
var dy = new Array();
 
var number;
var nx = new Array();
var ny = new Array();
var x_flag, y_flag;
 
var mode,page,col;
 
var z1 = new Array();
 
function sample(){
 
    mode = 1;
    page = 1;
 
    col = 1;
 
number = 100;
 
for(s=1;s<101;s++){
nx[s]=randn();
ny[s]=randn();
}
 
for (s = 1; s < 101; s++) {
z1[s] = 1;
if (Math.random() > 0.5) z1[s] = 2;
if (Math.random() > 0.5) z1[s] = 3;
 
}
for(s=1;s<101;s++){
bx[s]=0;
by[s]=0;
dx[s]=0;
dy[s]=0;
ball[s]=0;    
}
 
x_flag = 50;
y_flag = 50;
 
  $("#but").click(function () {
        strike();
    });
 
var timer;
var delay = 100;
 
var loop = function () {
 
 
 
 
 
    if (mode == 1) {
        move();
        wall();
        bomb();
        de();
 
        check();
    }
 
    if (mode == 2) {
        move();
        bomb();
        wall();
        de();
        cal();
    }
 
    if (mode == 3) {
        move();
        bomb();
        wall();
        de();
        colx();
    }
 
 
    if (mode == 1) paint();
 
    if (mode == 2) paintx();
 
    if (mode == 3) painty();
 
    clearTimeout(timer);
    timer = setTimeout(loop, delay);
}
 
loop();
 
}
 
function cal(){
 
    page = page + 1;
    if (page > 100) page = 1;
 
    if (Math.random() > 0.99) mode = 3;
 
}
 
function colx(){
 
    col = col + 1;
    if (col > 3) col = 1;
    if (Math.random() > 0.99) mode = 1;
 
}
 
function check(){
 
for(s=1;s<101;s++){
x1 = Math.floor(bx[s] / 10);
y1 = Math.floor(by[s] / 10);
h=0;
d1=(x1-x_flag)*(x1-x_flag);
d1=d1+(y1-y_flag)*(y1-y_flag);
if(d1<50)h=h+1;
if(ball[s]>60)h=h+1;
if (h == 2)mode=2;   
if (h == 2)ball[s]=0;   
 
}
 
 
 
}
 
 
 
function de(){
 
for(s=1;s<101;s++){
 h = 0;
if (by[s] < 10) h = h + 1;
if (ball[s] >50) h = h + 1;
if (h == 2) ball[s] = 0;
}
 
 
}
 
function bomb(){
 
for(s=1;s<101;s++){
x1 = Math.floor(bx[s] / 10);
y1 = Math.floor(by[s] / 10);
for(sx=1;sx<101;sx++){
h=0;
if(x1==nx[sx])h=h+1;
if(y1==ny[sx])h=h+1;
if (h == 2) dx[s] = -dx[s];
if (h == 2) dy[s] = -0.5*dy[s];   
}}
 
}
 
function wall() {
 
for(s=1;s<101;s++){
    h = 0;
if(bx[s]>990)h=h+1;    
if(dx[s]>0)h=h+1;
if (h == 2) dx[s] = -dx[s];
h = 0;
if(bx[s]<10)h=h+1;    
if(dx[s]<0)h=h+1;
if (h == 2) dx[s] = -dx[s];
}
 
 
}
 
function strike(){
 
 
    sx = 0;
for(s=1;s<101;s++){
if(ball[s]<50)sx=s;    
}
 
if (sx > 0) bx[sx] = 500;
if (sx > 0) by[sx] = 1000;
if (sx > 0) ball[sx] = 100;
if (sx > 0) dx[sx] =randx();
if (sx > 0) dy[sx] =0; 
}
 
 
function randx(){
 
n1=10*Math.random();
n2=Math.floor(n1)+1;
 
return n2;
}
function randn(){
 
n1=100*Math.random();
n2=Math.floor(n1)+1;
 
return n2;
}
 
 
function move(){
 
    g = 1;
 
for(s=1;s<101;s++){
dy[s] = dy[s] - g;
}  
 
for(s=1;s<101;s++){
bx[s]=bx[s]+dx[s];
by[s] = by[s] + dy[s];
}
 
 
 
 
}
 
function paint(){
 
var sub=new svgpaint();
 
str="<svg width=\"500\" height=\"500\">";
 
str=str+sub.rect(5,5,500,500,"blue");
for(s=1;s<101;s++){    
str=str+sub.rect(5*nx[s],500-5*ny[s],5,5,"black");
}
 
for(s=1;s<101;s++){    
if(ball[s]>50)str=str+sub.circle(5*bx[s]/10,500-5*by[s]/10,5,"red");
}
str=str+sub.circle(5*x_flag,500-5*y_flag,25,"green"); 
 
str=str+"</svg>";
 
$("#memo").html(str);   
 
}
 
function paintx(){
 
var sub=new svgpaint();
 
str="<svg width=\"500\" height=\"500\">";
for(s=1;s<11;s++){
    sx = s + page;
    if (sx > 100) sx = sx - 100;
if(z1[sx]==1)str=str+sub.rect(0,50*s-50,500,50,"red");
if(z1[sx]==2)str=str+sub.rect(0,50*s-50,500,50,"blue");
if(z1[sx]==3)str=str+sub.rect(0,50*s-50,500,50,"green");
 
}
str=str+"</svg>";
 
$("#memo").html(str);   
 
}
 
 
function painty(){
 
var sub=new svgpaint();
 
str="<svg width=\"500\" height=\"500\">";
 
str=str+sub.rect(5,5,500,500,"blue");
for(s=1;s<101;s++){    
str=str+sub.rect(5*nx[s],500-5*ny[s],5,5,"black");
}
 
for(s=1;s<101;s++){    
if(ball[s]>50)str=str+sub.circle(5*bx[s]/10,500-5*by[s]/10,5,"red");
}
 
if(col==1)str=str+sub.circle(5*x_flag,500-5*y_flag,25,"green"); 
if(col==2)str=str+sub.circle(5*x_flag,500-5*y_flag,25,"red"); 
if(col==3)str=str+sub.circle(5*x_flag,500-5*y_flag,25,"blue"); 
 
 
str=str+"</svg>";
 
$("#memo").html(str);   
 
}
最終更新:2015年06月04日 16:07