just for synchronize on my other computer

This commit is contained in:
Gnieark 2016-05-29 17:27:07 +02:00
parent 8f2071c596
commit 55e80fb781
2 changed files with 42 additions and 0 deletions

BIN
html/.testBot.html.kate-swp Normal file

Binary file not shown.

View File

@ -87,6 +87,48 @@ function playingAT(col){
grid[i][col]=symbol; grid[i][col]=symbol;
document.getElementById('td' + col + '_' + i).innerHTML = symbol; document.getElementById('td' + col + '_' + i).innerHTML = symbol;
addLog('player ' + currentPlayer + ', symbol ' + symbol + ' played col ' + col); addLog('player ' + currentPlayer + ', symbol ' + symbol + ' played col ' + col);
//does he win?
var x=col;
var y=i;
var searchValue="";
for var k=0; k < 4; k++){
searchValue +=symbol;
}
//horizontaly
var line="";
for (var k=0; k < 7; k++){
if(grid[y][k] == ""){
line += " ";
}else{
line += grid[y][k];
}
}
if (line.indexOf(searchValue) > -1){
wins(currentPlayer);
return;
}
//verticaly
var line="";
for (var k=0; k < 6; k++){
if(grid[k][x] == ""){
line += " ";
}else{
line += grid[k][x];
}
}
if (line.indexOf(searchValue) > -1){
wins(currentPlayer);
return;
}
//diagonals
//\
for (var kx=x, var ky=y; kx < 7, ky
//change player //change player
if(currentPlayer == 1){ if(currentPlayer == 1){
play(2); play(2);