function Piece(color, left) {
return { color: color.substr(0, 1),
left: left,
king: false };
}
function Go(color, king, first, left)
{
return {color: color,
king: king,
first: first,
left: left};
}
var board = new Object();
var currentTurn = "white";
var tableBoard = "<table id='chess'>";
var log = "";
board.color = ["#000000", "#FFFF00"];
board.piecesLeft = [12, 12];
board.color[0] = [];
board.color[1] = [];
for (var i = 0; i < 6; i += 1) {
board.color[0].push([]);
board.color[1].push([]);
tableBoard += "<tr>";
for (var j = 0; j < 6; j += 1) {
if ((i == 0 && j > 1) ||
((i == 2 && j < 4) || (i == 3 && j > 1)) ||
(i == 5 && j < 4)) {
board.color[0][i][j] = Piece("black", true);
} else {
board.color[0][i][j] = Piece("blank", false);
tableBoard += "<td style='background-color: black;'";
}
tableBoard += "'></td>";
if (((i < 2) || (i > 3 && i < 6)) ||
((i == 4 && j > 1) || (i == 5 && j < 4))) {
board.color[1][i][j] = Piece("white", true);
} else {
board.color[1][i][j] = Piece("blank", false);
tableBoard += "<td style='background-color: white;'";
}
tableBoard += "'></td>";
}
tableBoard += "</tr>";
}
tableBoard += "</table>";
var eatColor="";
function showConnection()
{
if (window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
}
else
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function ()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
log = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "write.php", true);
var firstrow