diff --git a/src/code.js b/src/code.js index 199e799..3ded689 100644 --- a/src/code.js +++ b/src/code.js @@ -1,44 +1,3 @@ -var board; - -function load() -{ - board = - [ - [ - [0, document.getElementById("id00")], - [0, document.getElementById("id01")], - [0, document.getElementById("id02")] - ], - [ - [0, document.getElementById("id10")], - [0, document.getElementById("id11")], - [0, document.getElementById("id12")] - ], - [ - [0, document.getElementById("id20")], - [0, document.getElementById("id21")], - [0, document.getElementById("id22")] - ] - ]; -} - -var ids = -{ - '00': [0, 0], - '01': [0, 1], - '02': [0, 2], - - '10': [1, 0], - '11': [1, 1], - '12': [1, 2], - - '20': [2, 0], - '21': [2, 1], - '22': [2, 2] -}; - -var ptm = 1; - function move(id) { if (board[ids[id][0]][ids[id][1]][0] != 0) @@ -68,10 +27,27 @@ function move(id) if (winner != 0) { - alert(winner); + score[winner - 1]++; + + info['score'].innerHTML = score[0] + " | " + score[1]; + info['go'] = "X's Go"; + + ptm = 1; reset(); + return; } + + if (ptm == 1) + { + charater = "X"; + } + else + { + charater = "O"; + } + + info['go'].innerHTML = charater + "'s Go"; } function win() diff --git a/src/index.html b/src/index.html index f7f03f7..09fd717 100644 --- a/src/index.html +++ b/src/index.html @@ -6,6 +6,7 @@ + @@ -52,11 +53,15 @@