diff --git a/src/predict.js b/src/predict.js index 847613c..9b36dfa 100644 --- a/src/predict.js +++ b/src/predict.js @@ -194,4 +194,18 @@ function resetPredict() function aiswitch() { dopredict = !dopredict; + + dopredictbutton.innerHTML = "AI: " + (dopredict ? "On" : "Off"); + + if (dopredict) + { + + var pre = calculate(ptm); + + board[pre[0]][pre[1]][1].parentElement.classList.add('predict'); + } + else + { + resetPredict(); + } } \ No newline at end of file diff --git a/src/var.js b/src/var.js index d7f7e10..61c1b1e 100755 --- a/src/var.js +++ b/src/var.js @@ -10,6 +10,7 @@ var gamemode; var root; var themesel; var dopredict; +var dopredictbutton; // called when all the resources for the page have been loaded @@ -77,6 +78,8 @@ function load() info['go'].innerHTML = "X's Go"; + dopredictbutton = document.getElementById('ai'); + setup(); }