This commit is contained in:
Gnieark 2016-05-28 15:03:50 +02:00
parent aac359c9d5
commit 5ab481344f

View File

@ -56,7 +56,11 @@ function createElem(type,attributes){
{elem.setAttribute(i,attributes[i]);} {elem.setAttribute(i,attributes[i]);}
return elem; return elem;
} }
function addLog(message){
var p=createElem('p');
p.innerHTML=message;
document.getElementById('logs').appendChild(p);
}
function changePlayerType(player,newValue){ function changePlayerType(player,newValue){
if(newValue == "bot"){ if(newValue == "bot"){
document.getElementById('url' + player).disabled=""; document.getElementById('url' + player).disabled="";
@ -81,7 +85,7 @@ 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);
//change player //change player
if(currentPlayer == 1){ if(currentPlayer == 1){
play(2); play(2);