previous

page 9

next
function get_pic() {
clear();
Shuffle(g_ind);
g_answer_id=Random0(4);
var pic_n=g_ind[g_answer_id];
if (g_used.includes(pic_n)) {
g_k++;
if (g_k<500) {
get_pic();
} else {
alert("Sorry - can't find another picture");
}
} else {
g_used.push(pic_n);
var el=document.getElementById('pic');
el.src='images/'+pic_n+'.jpg';
for (var i=0;i<5;i++) {
var el=document.getElementById(i);
var pic_n=g_ind[i];
el.textContent=g_pics[pic_n];
}
}
}

Why 500? No good reason - it just needs to be big!

Make sure you try this out before proceeding. You should get that alert message after you've seen all your pictures.

previous
next