previous

page 27

next
check() with g_ships added
function check() {
var parts=[0,1,1,2,2,3,3,4,4];
var counts=[];
for (var i=0;i<9;i++) counts[i]=0;
for (var id=0;id<100;id++) {
var el=document.getElementById(id);
var sn=el.getAttribute('sn');
if (sn>0) {
var a=el.getAttribute('a');
var v=el.getAttribute('v');
if (a==v) counts[sn]++;
}
}
var n=0;
for (var i=1;i<9;i++) {
if (counts[i]==parts[i]) {
n++;
var el=document.getElementById('s'+i);
el.style.opacity=1;
}
}
g_ships=n;
}
previous
next