アットウィキロゴ

やk

<!DOCTYPE html>
<html lang="ja">
    <head>
        <meta charset="utf-8" />
        <script src="sample.js"></script>
        <script src="jquery.js"></script>
        <script src="base.js"></script>
        <title>信長の野望</title>
    </head>
    <body onload="sample()">
        <p id="memo"></p>
 
 
    </body>
</html>
 
 
var base = new Array();
var point_v = new Array();
var point_h = new Array();
 
var point;
var out;
var home;
var inn;
 
function sample() {
 
for(s=1;s<4;s++){
base[s]=0;
}
 
 
inn = 1;
home = 1;
out = 0;
point = 0;
 
var timer;
var delay = 100;
 
var loop = function () {
 
    var sub = new base();
    sub.base = base;
    sub.out = out;
    sub.point = point;
    sub.game();
    out = sub.out;
    point = sub.point;
    base = sub.base;
 
    if (out > 2.5) change();
     if (inn > 9.5) shuffle();
 
    paint();
 
    clearTimeout(timer);
    timer = setTimeout(loop, delay);
}
 
loop();
 
 
 
}
 
function paint(){
 
    var str = "" + inn + "回" + out + "アウト";
 
$("#memo").html(str);
 
 
}
function shuffle(){
 
    inn = 1;
    home = 1;
 
    }
 
function change(){
 
if(home==1)point_v[inn] = point;
if(home==2)point_h[inn] = point;
 
home = home + 1;
if (home > 2) inn = inn + 1;
if (home > 2) home = 1;
 
out=0;
}
 
 
 
class base{
 
out:number;
base:number[]=new Array();
point:number;
hit:number;
 
game():void{
 
this.play();
 
if(this.hit<50)this.out=this.out+1;
if(this.hit>50)this.step();
 
}
 
step():void{
 
if(this.base[3]>50)this.point=this.point+1;
if(this.base[3]>50)this.base[3]=0;
if(this.base[2]>50)this.base[3]=100;
if(this.base[2]>50)this.base[2]=0;
if(this.base[1]>50)this.base[2]=100;
 
this.base[1]=100;
 
}
 
 
play():void{
 
this.hit=0;
if(Math.random()>0.5)this.hit=100;
 
}
 
}
 
最終更新:2015年10月03日 19:12