1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var kaiten_flag = 0;
var timer = new Array(3);
function start() {
if (kaiten_flag != 0) return;
for (var i = 0; i < 3; i++)
timer[i] = setInterval(kaiten, 100, i);
kaiten_flag = 0x7;
}
var reel_val = [ 1, 1, 1 ];
var reel = document.getElementsByClassName("reel");
function kaiten(i) {
reel_val[i] = (reel_val[i] + 1) % 10;
reel[i].innerHTML = reel_val[i].toString();
}
function stop(i) {
var flag = 0x1 << i;
if ((kaiten_flag & flag) == 0) return;
clearInterval(timer[i]);
kaiten_flag &= ~flag;
}