previous

page 37

next
the auto facility - making it happen - 2
function auto_do() {
if (g_auto_ids.length>0) {
var id0=g_auto_ids.pop();
// look in temp
for (var i=0;i<4;i++) {
var id=g_temp_col[i];
if (id==id0) {
g_temp_col[i]=-1;
auto_place(id); draw();
break;
}
}
// look in main
for (var c=1;c<9;c++) {
var ids=g_main_cols[c];
var id=last_card(ids);
if (id==id0) {
g_main_cols[c].pop();
auto_place(id); draw();
break;
}
}
setTimeout(auto_do,400);
}
}

Make sure that you return deal() to its original state after you've convinced yourself that everything is working ok.

previous
next