Skip to content

Commit 4fbab4f

Browse files
committed
added comment to script.js
1 parent d9c04f5 commit 4fbab4f

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

script.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
//Things I can add, adjust, can do better
2+
//1. Add a timer to the pc decision to give the impression the PC is thinking
3+
//2. make the computer more intelligent by teaching it the rules and strategies of the game
4+
//3. add difficulties
5+
//4. Optimize code
6+
// a. optimize the methodes
7+
// b. optimize the objects
8+
// c. use jquery
9+
//5. make a version with canvas instead of html table
10+
//6. add sound
11+
112
//View object is responsible for displaying the status of the game on the page
213
var view = {
314
//display function will display X or O on the right location
@@ -74,6 +85,7 @@ var model = {
7485
symbols: ["X", "O"],
7586
moves: [" "," "," "," "," "," "," "," "," "],
7687
tdId: ["00","01","02","10","11","12","20","21","22"],
88+
7789
//randomly choose the symbol for the player and computer
7890
pickRandom: function(){
7991
var randomIndex = Math.floor(Math.random()*2);
@@ -125,9 +137,7 @@ var model = {
125137
if(this.moves.indexOf(" ") != -1){
126138
var random = Math.floor(Math.random() * 9);
127139
if(this.moves[random] != "X" && this.moves[random] != "O"){
128-
console.log(random);
129140
this.moves[random] = this.pcSymbol;
130-
console.log(this.moves);
131141
view.display(this.pcSymbol, this.tdId[random]);
132142
makeDecision = false;
133143
}
@@ -208,14 +218,9 @@ var model = {
208218
}
209219
}
210220

211-
212221
function init(){
213222
var buttonStatus = document.getElementById("startGame");
214223
buttonStatus.onclick = controller.startGame;
215-
216-
217224
}
218225

219226
window.onload = init;
220-
221-

0 commit comments

Comments
 (0)