changeButton(this.id);
var x = this.id.charAt(2);
var y = this.id.charAt(3);
if (x – 1 > 0) {
changeButton(‘bt’ + (x – 1) + y);
}
if (y – 1 > 0) {
changeButton(‘bt’ + x + (y – 1));
}
var newX = 1 + parseInt(x);
if (x + 1 <= maxX) {
changeButton(‘bt’ + newX + y);
}
var newY = 1 + parseInt(y);
if (y + 1 <= maxY) {
changeButton(‘bt’ + x + newY);
}
step++;
document.getElementById(“step”).innerHTML = step;
});
}
function changeButton(id) {
var button = document.getElementById(id);
if (button.className === “darkButton”) {
button.className = “lightButton”;
}










