المتميزون



انضم إلى المنتدى ، فالأمر سريع وسهل

المتميزون

المتميزون

= 0; i < num; i++) { x = Math.floor(Math.random(4) * 4); if (x == 0) { toggle15(form, ex, ey, ex + 1, ey); } else if (x == 1) { toggle15(form, ex, ey, ex - 1, ey); } else if (x == 2) { toggle15(form, ex, ey, ex, ey + 1); } else if (x == 3) { toggle15(form, ex, ey, ex, ey - 1); } } } function play15(form, x, y) { if (Math.abs(ex - x) + Math.abs(ey - y) == 1) { done = toggle15(form, x, y, x+1, y); if (!done) { done = toggle15(form, x, y, x-1, y); } if (!done) { done = toggle15(form, x, y, x, y+1); } if (!done) { done = toggle15(form, x, y, x, y-1); } moves++; if (check15(form)) { alert('You win with ' + moves + ' moves!'); resetboard15(form); } } } function showrules15() { rules = 'لعبة لوح الأرقام nn' + 'هدف اللعبة هو ترتيب n' + 'الأرقام من 1 الى 15 بنفس n' + 'الترتيب اللي ظاهر عندك ببداية اللعبةn' + 'اضغط على خلط وابدأ اللعبn' + 'وتفوز اذا رتبت كل الأرقامn' + 'والمربع اللي يبقى فاضي بالأخير n' + 'هو اللي بأسفل الزاوية اليمنى'; alert(rules); } function resetboard15(form) { for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { val = 1 + i + (4*j); if (val == 16) { getElement15(form,i + '_' + j).value = ' '; } else { getElement15(form,i + '_' + j).value = val; } } } score = 0; moves = 0; ex = 3; ey = 3; } function toggle15(form, x, y, x1, y1) { if (x < 0 || y < 0 || x > max || y > max) { return false; } if (x1 < 0 || y1 < 0 || x1 > max || y1 > max) { return false; } name = x + '_' + y; button = getElement15(form,name); name = x1 + '_' + y1; button1 = getElement15(form,name); if (button.value == ' ' || button1.value == ' ') { tmp = button.value; button.value = button1.value; button1.value = tmp; if (button.value == ' ') { ex = x; ey = y; } else { ex = x1; ey = y1; } return true; } return false; } function check15(form) { score = 0; for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { val = 1 + i + (4*j); if (val < 16) { if (getElement15(form,i + '_' + j).value == val) { score++; } } } } return score == 15; }

معلومات

The page 1 does not exist
الوقت/التاريخ الآن هو الإثنين مارس 18, 2024 11:34 pm