
previous

page 25
next
seed.js
We now have a bit of work to do here. First change both hor and ver:
function hor(n,sn) {
...
set_a_sn(r0+1,c0+i,v,sn);
...
function ver(n,sn) {
...
set_a_sn(r0+i,c0+1,v,sn);
...
...
set_a_sn(r0+1,c0+i,v,sn);
...
function ver(n,sn) {
...
set_a_sn(r0+i,c0+1,v,sn);
...
and finally ...
seed()
function seed() {
ver(4,8);
hor(4,7);
ver(3,6);
hor(3,5);
ver(2,4);
hor(2,3);
ver(1,2);
hor(1,1);
}
ver(4,8);
hor(4,7);
ver(3,6);
hor(3,5);
ver(2,4);
hor(2,3);
ver(1,2);
hor(1,1);
}
Now everything is in place. All we have to do is write a check function that will scan the whole grid to ascertain which ships are complete.
As usual have a go yourself first. The only line you may need help with is this one:
el.style.opacity=1;
previous
next