From 1d4d5ad92e5dc44e1434ac3d51df78aaa227a433 Mon Sep 17 00:00:00 2001 From: AUnicornWithNoLife <55228370+AUnicornWithNoLife@users.noreply.github.com> Date: Wed, 11 Jan 2023 22:59:50 +0000 Subject: [PATCH] fix bug --- src/predict.js | 14 ++++++++++++++ src/var.js | 3 +++ 2 files changed, 17 insertions(+) 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(); }