var button = []; //stores the canvases
for(var i=1; i<10; i++) button[i] = document.getElementById('canvas'+i);

var ctx = []; //stores the context of the canvases
for(var i=1; i<10; i++) ctx[i] = button[i].getContext();

var bDisabled = []; //stores the availability of the button
for(var i=1; i<10; i++) bDisabled[i] = false; //all buttons are enabled in the beginning

var isResult = false;
var content = [];


@@ -204,18 +204,25 @@
 %5Bi%5D.
-ge
+msGetInpu
 tContext
 ();%0A
@@ -221,10 +221,8 @@
 text
-()
 ;%0A%0Av
@@ -411,8 +411,227 @@
  = %5B%5D;%0A%0A
+function loop(x)%0A%7B%0A    if(!bDisabled%5Bx%5D)%7B //button does not currently contain X or O and therefore is enabled.%0A        bDisabled%5Bx%5D = true; //button now contains something%0A        console.log(%22Button pressed.%22);%0A    %7D%0A%7D

initialize loop function for button press