PHP code
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>AiChat.Wap.Sh</title>
</head>
<body>
<div data-xtcontainer="container" class="phdr">Game Caro
</div> <center><STYLE type=Text/CSS>INPUT {
}
.blokje {
FONT-WEIGHT: 900; FONT-SIZE: 16pt; WIDTH: 48px; FONT-FAMILY: Comic Sans MS,Arial,Verdana; HEIGHT: 48px; TEXT-ALIGN: center
}
.knopje {
WIDTH: 144px
}
</STYLE>
<!--
This script downloaded from
http://www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at
http://www.JavaScriptBank.com
-->
<SCRIPT language=JavaScript>
<!--//
timerID = xtal = ytal = ztal = auto = 0;
wie = 'Người chơi 1';
function initieer(){
clearTimeout(timerID);
cel = new Array(0,0,0,0,0,0,0,0,0,0);
aanv = new Array(); strat = verd = leeg = aanv;
beurt = wissel = 1; wint = keren = 0;
document.forms[0].speler1.value = xtal;
document.forms[0].speler2.value = ytal;
document.forms[0].remise.value = ztal;
if (wie != 'Start') {
for (i in cel) {
cel[i] = 0; if (i > 0) {document.forms[0].elements[i].value = ''};
}
}
document.forms[0].beurten.value = wie;
}
function zetten() {
clearTimeout(timerID);
if (aanv[0] > 0) {
slag = aanv[Math.floor(Math.random() * 10) % aanv.length]
} else if (verd[0] > 0) {
slag = verd[Math.floor(Math.random() * 10) % verd.length];
} else if (strat[0] > 0) {
slag = strat[Math.floor(Math.random() * 10) % strat.length];
} else {
slag = leeg[Math.floor(Math.random() * 10) % leeg.length];
}
<pre><code>if (beurt == 0 && slag > 0) {document.forms[0].elements[slag].click()};
</code></pre>
}
function win() {
if ( cel[1] + cel[2] + cel[3] == 3 ||
cel[4] + cel[5] + cel[6] == 3 ||
cel[7] + cel[8] + cel[9] == 3 ||
cel[1] + cel[4] + cel[7] == 3 ||
cel[2] + cel[5] + cel[8] == 3 ||
cel[3] + cel[6] + cel[9] == 3 ||
cel[1] + cel[5] + cel[9] == 3 ||
cel[3] + cel[5] + cel[7] == 3
) {
<pre><code>if (confirm("Người chơi 1: Bạn thắng !!! Chơi lại nhé?"))
{
wint = 1;
xtal++; wie = 'Người chơi 1'; timerID = setTimeout('initieer()',800)
} else {
xtal++; wie = 'Start'; timerID = setTimeout('initieer()',800)
};
}
</code></pre>
if ( cel[1] + cel[2] + cel[3] == 30 ||
cel[4] + cel[5] + cel[6] == 30 ||
cel[7] + cel[8] + cel[9] == 30 ||
cel[1] + cel[4] + cel[7] == 30 ||
cel[2] + cel[5] + cel[8] == 30 ||
cel[3] + cel[6] + cel[9] == 30 ||
cel[1] + cel[5] + cel[9] == 30 ||
cel[3] + cel[5] + cel[7] == 30
) {
if (confirm(((auto == 1) ? ('Máy thắng, xin lỗi') : ('Người chơi 2: Bạn thắng !!')) + "! Chơi lại nhé?")) {
ytal++; wie = 'Người chơi 1'; timerID = setTimeout('initieer()',800)
} else {
ytal++; wie = 'Start'; timerID = setTimeout('initieer()',800)<br />
};
}
}
function wisselen(beurt){
if (wissel == 1) {
if (beurt == 0) {
beurt = 1;
wie = "Người chơi " + 1
}
else {
if (auto == 0) {beurt = 0;
wie = "Người chơi " + 2} else {beurt = 0; wie = "Computer";}
}
if (keren == 9
) {
if (confirm("Hòa!!!n Chơi lại nhé?")) {
ztal++; wie = 'Người chơi 1'; timerID = setTimeout('initieer()',800)} else
{ztal++; wie = 'Start'; timerID = setTimeout('initieer()',800)};
}
}
else {
beurt = beurt;
}
wissel = 1;
return(beurt);
}
function wijziging(klik) {
plek = cel[klik]; geklikt = klik;
if (plek == 0){
if (beurt == 0){
xo = "O";
plek = 10;
} else {
xo = "X";
plek = 1;
}
cel[klik] = plek; keren++;
}
else {
if (plek == 10){
xo = "O";}
if (plek == 1){
xo = "X";}
wissel = 0
}
return(xo);
}
function verdedig() {leeg = new Array(); verd = new Array();
for (i = 1; i < 10; i++) { oud = cel[i]; cel[i] = 1;
if ( (cel[1] + cel[2] + cel[3] == 3 ||
cel[4] + cel[5] + cel[6] == 3 ||
cel[7] + cel[8] + cel[9] == 3 ||
cel[1] + cel[4] + cel[7] == 3 ||
cel[2] + cel[5] + cel[8] == 3 ||
cel[3] + cel[6] + cel[9] == 3 ||
cel[1] + cel[5] + cel[9] == 3 ||
cel[3] + cel[5] + cel[7] == 3) && oud == 0
) { verd[verd.length] = i}
cel[i] = oud;
if (cel[i] == 0) {
if (keren != 1) {leeg[leeg.length] = i} else
if (cel[5] == 0) {leeg[0] = 5; leeg[1] = 10 - geklikt} else
if (i % 2 != 0) {leeg[leeg.length] = i}
};
}
}
function aanval() {aanv = new Array();
for (i = 1; i < 10; i++) { oud = cel[i]; cel[i] = 10;
if ( (cel[1] + cel[2] + cel[3] == 30 ||
cel[4] + cel[5] + cel[6] == 30 ||
cel[7] + cel[8] + cel[9] == 30 ||
cel[1] + cel[4] + cel[7] == 30 ||
cel[2] + cel[5] + cel[8] == 30 ||
cel[3] + cel[6] + cel[9] == 30 ||
cel[1] + cel[5] + cel[9] == 30 ||
cel[3] + cel[5] + cel[7] == 30) && oud == 0
) { aanv[aanv.length] = i}
cel[i] = oud;
}
}
function strategie() {strat = new Array();
for (i = 1; i < 10; i++) { oud = cel[i]; cel[i] = 10;
if ( (cel[1] + cel[2] + cel[3] == 20 ||
cel[4] + cel[5] + cel[6] == 20 ||
cel[7] + cel[8] + cel[9] == 20 ||
cel[1] + cel[4] + cel[7] == 20 ||
cel[2] + cel[5] + cel[8] == 20 ||
cel[3] + cel[6] + cel[9] == 20 ||
cel[1] + cel[5] + cel[9] == 20 ||
cel[3] + cel[5] + cel[7] == 20) && oud == 0
) {
if (keren != 3) {strat[strat.length] = i} else if (i % 2 != 0) {strat[strat.length] = i}
}
cel[i] = oud;
}
}
function wijzig(form,element){
wijziging(element.name);
element.value = xo;
beurt = wisselen(beurt);
form.beurten.value = wie;
verdedig(); aanval(); strategie(); win();
if (auto == 0 || wint == 1) {return} else {
timerID = setTimeout('zetten()',600)
}
}
initieer();
//-->
</SCRIPT>
<!--
This script downloaded from
http://www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at
http://www.JavaScriptBank.com
-->
<FORM><INPUT class=knopje title="Click here to play again" onclick="wie = 'Người chơi 1'; initieer()" type=button value="Người chơi 1" name=beurten Width="164px">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<CAPTION>
<SCRIPT language=JavaScript>
<!--//
for (i = 1; i < 10; i++) {
if (i % 3 == 1) {document.write('<Tr>');}
document.write('<Td><Input Type="Button" Name="' + i + '" Value=" " Class="blokje" onClick="wijzig(this.form,this)"></Td>');
if (i % 3 == 0) {document.write('</Tr>');}
}
//-->
</SCRIPT>
</CAPTION>
<TBODY>
<TR>
<TD></TD></TR></TBODY></TABLE>
<pre><code><INPUT id=autmat
</code></pre>
title="Click here to change from 2 players or computergame"
onclick="if (this.value == 'Computer') {this.value = '2 players'; auto = 0} else {this.value = 'Computer'; auto = 1}; wie = 'Người chơi 1'; initieer();"
type=checkbox value="2 players" name=automaat><LABEL for=autmat>chơi lại với máy</LABEL>
<TABLE cellSpacing=0 cellPadding=0 border=1>
<TBODY>
<TR bgColor=#c0c0c0>
<TD align=middle>Người chơi 1 </TD>
<TD align=middle>Người chơi 2 </TD>
<TD align=middle>Hòa </TD></TR>
<TR bgColor=#c0c0c0>
<TD align=middle><INPUT title="Người chơi 1"
style="BORDER-RIGHT: 0px solid; BORDER-TOP: 0px solid; BORDER-LEFT: 0px solid; BORDER-BOTTOM: 0px solid; BACKGROUND-COLOR: transparent; TEXT-ALIGN: center"
readOnly size=3 value=0 name=speler1></TD>
<TD align=middle><INPUT title="Người chơi 2"
style="BORDER-RIGHT: 0px solid; BORDER-TOP: 0px solid; BORDER-LEFT: 0px solid; BORDER-BOTTOM: 0px solid; BACKGROUND-COLOR: transparent; TEXT-ALIGN: center"
readOnly size=3 value=0 name=speler2></TD>
<TD align=middle><INPUT title=Hòa
style="BORDER-RIGHT: 0px solid; BORDER-TOP: 0px solid; BORDER-LEFT: 0px solid; BORDER-BOTTOM: 0px solid; BACKGROUND-COLOR: transparent; TEXT-ALIGN: center"
readOnly size=3 value=0 name=remise></TD></TR></TBODY></TABLE>
<pre><code> </FORM>
<!--
This script downloaded from
http://www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at
http://www.JavaScriptBank.com
-->
</code></pre>
</center>
</body>
</html>
a
Copy code
Lượt xem:0
Online:
Guests: 1