PDA

View Full Version : لعبه مجانيه


الجني 1
15-12-1999, 06:00 AM
<HEAD>

<SCRIPT LANGUAGE="JavaScript">

< !-- Begin
step = 0;
diff=3;
function clear_all(form) {
step = 0;
for (i=0;i<9; ++i) {
position="a"+i;
form[position].value="";
}
}
function clickit(field) {
if (step == -1) {alert("اضغط زر لعبة جديدة لتبدأ من جديد"); return;}
position=field.name.substring(1,2,1);
position = 'a'+position;
if (field.form[position].value !="") {alert("لا يمكن الذهاب هنا"); return;}
field.form[position].value="X";
if (eval_pos(field.form)) {
field.form.output.value="انت الفائز";
step = -1;
return;
}
position=get_move(field.form);
field.form.output.value='انا انتقل إلى ' + position.substring(1,2,1);
if (position=="") {
field.form.output.value="لا فائز";
step = -1;
return;
}
field.form[position].value="O";
if (eval_pos(field.form)) {
field.form.output.value="هاها لقد خسرت";
step = -1;
}
}
function eval_pos(form) {
if ((form.a0.value!="" && form.a0.value==form.a3.value && form.a0.value==form.a6.value)| |
(form.a0.value!="" && form.a0.value==form.a1.value && form.a0.value==form.a2.value) | |
(form.a0.value!="" && form.a0.value==form.a4.value && form.a0.value==form.a8.value) | |
(form.a1.value!="" && form.a1.value==form.a4.value && form.a1.value==form.a7.value) | |
(form.a2.value!="" && form.a2.value==form.a5.value && form.a2.value==form.a8.value) | |
(form.a2.value!="" && form.a2.value==form.a4.value && form.a2.value==form.a6.value) | |
(form.a3.value!="" && form.a3.value==form.a4.value && form.a3.value==form.a5.value) | |
(form.a6.value!="" && form.a6.value==form.a7.value && form.a6.value==form.a8.value))
return true;
else
return false;
}
function f(a) {
if (a == "") return "."; else return a;
}
function comp_move(form,player,weight,depth) {
var cost;
var bestcost=-2;
var position;
var newplayer;
if (player=="X") newplayer="O"; else newplayer="X";
if (depth==diff) return 0;
if (eval_pos(form)) return 1;
for (var i=0; i<9; ++i) {
position='a'+i;
if (form[position].value != "")
continue;
form[position].value=player;
cost = comp_move(form,newplayer, -weight, depth+1);
if (cost > bestcost) {
bestcost=cost;
if (cost==1) i=9;
}
form[position].value="";
}
if (bestcost==-2) bestcost=0;
return(-bestcost);
}
function get_move(form) {
var cost;
var bestcost=-2;
bestmove="";
if (step++ == 0)
if (form.a4.value=="")
return "a4";
else
if (form.a0.value=="")
return "a0";
for (var i=0; i<9; ++i) {
localposition='a'+i;
if (form[localposition].value != "")
continue;
form[localposition].value="O";
cost=comp_move(form,"X", -1, 0);
if (cost > bestcost) {
if (cost==1) i=9;
bestmove=localposition;
bestcost=cost;
}
form[localposition].value="";
}
return bestmove;
}
function complain(field) {
field.form.output.focus();
alert("Don't change the game fields directly!");
}
// End -->
</SCRIPT>
</HEAD>

< !-- الخطوة الثانية -->

<BODY>

<CENTER>
اضغط على الزر لتظهر الاكس
<HR>
<FORM>
<INPUT SIZE=1 NAME="a0" OnFocus="complain(this)">
<INPUT TYPE="button" NAME="b0" OnClick="clickit(this)">
<INPUT SIZE=1 NAME="a1" OnFocus="complain(this)">
<INPUT TYPE="button" NAME="b1" OnClick="clickit(this)">
<INPUT SIZE=1 NAME="a2" OnFocus="complain(this)">
<INPUT TYPE="button" NAME="b2" OnClick="clickit(this)">


<INPUT SIZE=1 NAME="a3" OnFocus="complain(this)">
<INPUT TYPE="button" NAME="b3" OnClick="clickit(this)">
<INPUT SIZE=1 NAME="a4" OnFocus="complain(this)">
<INPUT TYPE="button" NAME="b4" OnClick="clickit(this)">
<INPUT SIZE=1 NAME="a5" OnFocus="complain(this)">
<INPUT TYPE="button" NAME="b5" OnClick="clickit(this)">


<INPUT SIZE=1 NAME="a6" OnFocus="complain(this)">
<INPUT TYPE="button" NAME="b6" OnClick="clickit(this)">
<INPUT SIZE=1 NAME="a7" OnFocus="complain(this)">
<INPUT TYPE="button" NAME="b7" OnClick="clickit(this)">
<INPUT SIZE=1 NAME="a8" OnFocus="complain(this)">
<INPUT TYPE="button" NAME="b8" OnClick="clickit(this)">

Message: <INPUT NAME="output" TYPE="text">

الصعوبة <SELECT NAME="difficulty"
OnChange="diff=form.difficulty[form.difficulty.selectedIndex].value;">
<OPTION VALUE=1> سهل جدا
<OPTION VALUE=2> سهل
<OPTION VALUE=3 SELECTED> متوسط
<OPTION VALUE=4> صعب
</SELECT>


<INPUT TYPE="button" VALUE="الكمبيوتر يبدأ اولا " OnClick="
if (!step++) this.form.a4.value='O';">


<INPUT TYPE="reset" VALUE="لعبة جديدة" OnClick="clear_all(this.form)">
</FORM>
</CENTER>

</BODY>
لا ابد مافيه شىء
كل عام وانتم بخير

الجني 1
15-12-1999, 06:12 AM
ليه ماتشتغل
سوتالف وبش اللي ناقصها!؟
يامراقبين فهموني بلييييييييز
لا ابد مافيه شىء
بس حبيت اشغل لعبه
واهديها لكم
بس مافيش فايده http://www.swalif.net/swalif1/ubb/smile.gif