A Pen by Ofor Chinedu on CodePen.
Created
November 29, 2016 16:51
-
-
Save oforchinedu/2be4d06973fb4887c685c2825c97b23c to your computer and use it in GitHub Desktop.
X and O
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <link href='https://fonts.googleapis.com/css?family=Satisfy' rel='stylesheet' type='text/css'> | |
| <div class="container text-center"> | |
| <h1 class="title">Tic-Tac-Toe</h1> | |
| <button id="start-game" onclick = "" class="btn-default btn btn-lg">START</button> | |
| <table class="text-center"> | |
| <tr class="box"> | |
| <td id="1" class="square"></td> | |
| <td id="2" class="square"></td> | |
| <td id="3" class="square"></td> | |
| </tr> | |
| <tr class="box"> | |
| <td id="4" class="square"></td> | |
| <td id="5" class="square"></td> | |
| <td id="6" class="square"></td> | |
| </tr> | |
| <tr class="box"> | |
| <td id="7" class="square"></td> | |
| <td id="8" class="square"></td> | |
| <td id="9" class="square"></td> | |
| </tr> | |
| </table> | |
| <button id="reset"class="btn btn-success" >New Game</button> | |
| <footer> | |
| <p>©Copyright <a href="hhttp://codepen.io/techboss/" target="_blank">Ofor Chinedu P.</a> 2016.</p> | |
| </footer> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $("#start-game").click(function(){ | |
| startGame(); | |
| }) | |
| function startGame(){ | |
| // Check fo user Input | |
| var choice = prompt("enter x or o") | |
| var comp = "" | |
| var user = "" | |
| var chx = "X" | |
| var cho = "O" | |
| if(choice === "x" || choice === "X"){ | |
| user = chx | |
| comp = cho | |
| } | |
| else if(choice === "o" || choice === "O"){ | |
| user = cho | |
| comp = chx | |
| } | |
| else { | |
| alert("Invalide Choice"); | |
| } | |
| //console.log(user) console.log(comp) | |
| //watch out for click event of the cells | |
| $(".square").click(function(){ | |
| if(this.id == 1){ | |
| if($("#1").text() == ""){ | |
| $("#1").text(user); | |
| computer(); | |
| } | |
| else{ | |
| alert("Has value") | |
| } | |
| } | |
| else if(this.id == 2){ | |
| if($("#2").text() == ""){ | |
| $("#2").text(user); | |
| computer(); | |
| } | |
| else{ | |
| alert("Has value") | |
| } | |
| } | |
| else if(this.id == 3){ | |
| if($("#3").text() == ""){ | |
| $("#3").text(user); | |
| computer(); | |
| } | |
| else{ | |
| alert("Has value") | |
| } | |
| } | |
| else if(this.id == 4){ | |
| if($("#4").text() == ""){ | |
| $("#4").text(user); | |
| computer(); | |
| } | |
| else{ | |
| alert("Has value") | |
| } | |
| } | |
| else if(this.id == 5){ | |
| if($("#5").text() == ""){ | |
| $("#5").text(user); | |
| computer(); | |
| } | |
| else{ | |
| alert("Has value") | |
| } | |
| } | |
| else if(this.id == 6){ | |
| if($("#6").text() == ""){ | |
| $("#6").text(user); | |
| computer(); | |
| } | |
| else{ | |
| alert("Has value") | |
| } | |
| } | |
| else if(this.id == 7){ | |
| if($("#7").text() == ""){ | |
| $("#7").text(user); | |
| computer(); | |
| } | |
| else{ | |
| alert("Has value") | |
| } | |
| } | |
| else if(this.id == 8){ | |
| if($("#8").text() == ""){ | |
| $("#8").text(user); | |
| computer(); | |
| } | |
| else{ | |
| alert("Has value") | |
| } | |
| } | |
| else if(this.id == 9){ | |
| if($("#9").text() == ""){ | |
| $("#9").text(user); | |
| computer(); | |
| } | |
| else{ | |
| alert("Has value") | |
| } | |
| } | |
| }); | |
| // COmputer checks for available spaces | |
| function computer(){ | |
| // Moves if user make 5 comp | |
| if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == "" && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#5").text(comp); | |
| } | |
| // 1 and 5 click 2 | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| alert("computer wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#4").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Draw!!!"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#6").text(comp); | |
| alert("computer wins!!!!") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#6").text(comp); | |
| alert("computer wins!!!") | |
| } | |
| // 1 and 5 click 3 | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#2").text(comp); | |
| } | |
| // here | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| alert("Computer Wins!"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| alert("Computer Wins!!!"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| alert("Computer Wins!"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| alert("Computer Wins!"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#4").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#6").text(comp); | |
| alert("Computer Wins!!!"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == user){ | |
| $("#6").text(comp); | |
| alert("Computer Wins!!!"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| alert("Its a Draw!!! play again"); | |
| } | |
| // 1 and 5 click 4 | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| } | |
| //here | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| alert("Computer Wins!"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| alert("Computer Wins!"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| alert("Computer Wins!"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| alert("Computer Wins!!!"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#2").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| alert("Computer Wins!"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| alert("Computer Wins!"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == comp){ | |
| alert("Draw!!! play again"); | |
| } | |
| // 1 and 5 click 6 | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#2").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| alert("Computer Winssssss") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| alert("Computer Winssssss") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == comp){ | |
| alert("Draw!!"); | |
| } | |
| // 1 and 5 click 7 | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#4").text(comp) | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#6").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#6").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#6").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#6").text(comp); | |
| alert("Computer Wins!!"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#2").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == comp && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == user){ | |
| alert("Draw play again"); | |
| } | |
| // 1 and 5 click 8 | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#4").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#6").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#6").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#6").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == user){ | |
| $("#6").text(comp); | |
| alert("Computer Wins!!") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#3").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| alert(" a draw!!!") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#2").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| alert("Its a draw!!!") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#3").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| alert("Its a draw!!!"); | |
| } | |
| // 1 and 5 click 9 | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#2").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#6").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| alert("Its a draw!!!") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| alert("computer wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| alert("computer wins!!") | |
| } | |
| // Moves if 2 is user 5 make comp | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == "" && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#5").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#4").text(comp); | |
| alert("Computer Wins!!!"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#6").text(comp); | |
| alert("Computer Wins!!!"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#6").text(comp); | |
| alert("Computer Wins!!!"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Its a draw!!!"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#1").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins!!!"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#6").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#4").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == user){ | |
| $("#4").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| alert("Its a draw!!!!"); | |
| } | |
| // 2 nd 4 | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#1").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins!!"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Its a draw!!!!!"); | |
| } | |
| // 2 nd 6 | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| alert("Computer Wins!!"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == comp){ | |
| $("#1").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#1").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == comp){ | |
| $("#4").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| alert("Its a draw!!!"); | |
| } | |
| // 2 nd 7 | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#1").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins!"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| } | |
| //here | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#6").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Its a draw!!!!"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#6").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Its a draw!!!!!"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Its a draw!!!"); | |
| } | |
| // 2 nd 8 | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#1").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#1").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#1").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#1").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#1").text(comp); | |
| alert("Computer Wins!!"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#6").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| alert("Its a draw!!!!"); | |
| } | |
| // 2 nd 8 | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| alert("Computer Wins!!!"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| } | |
| // here | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#4").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Its a draw!!!!"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#1").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Its a draw!!!"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#1").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Its a draw!!!"); | |
| } | |
| // Moves if 3 is user make 5 comp | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == "" && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#5").text(comp); | |
| } | |
| // 3 and 4 | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#1").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() =="" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() =="" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() =="" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins!"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() =="" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#6").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| alert("Its a draw!!!!!"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() ==comp && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() =="" && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Its a draw!!!"); | |
| } | |
| ///here | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Its a draw"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| alert("Its a draw!!!"); | |
| } | |
| // 3 and 6 | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == comp){ | |
| $("#1").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == comp){ | |
| $("#1").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == comp){ | |
| $("#1").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#1").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == comp){ | |
| $("#2").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == comp){ | |
| $("#8").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == comp){ | |
| $("#8").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#7").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| alert("Its a draw!!!"); | |
| } | |
| // 3 and 7 | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#4").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#6").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#6").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#6").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#6").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == comp){ | |
| $("#2").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == comp){ | |
| $("#8").text(comp); | |
| alert("Draw") | |
| } | |
| //continue!! | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == comp){ | |
| $("#1").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#1").text(comp); | |
| alert("Computer Wins") | |
| } | |
| // 3 and 8 | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#4").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#6").text(comp); | |
| alert("Computer Wins!!"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#6").text(comp); | |
| alert("Computer Wins!!"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#6").text(comp); | |
| alert("Computer Wins!!"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == user){ | |
| $("#6").text(comp); | |
| alert("Computer Wins!!"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#1").text(comp); | |
| alert("Computer Wins!!"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#1").text(comp); | |
| alert("Computer Wins!!"); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#2").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| alert("Draw") | |
| } | |
| // 3 and 8 | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#6").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#4").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#4").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#4").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == user){ | |
| $("#4").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#2").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| alert("Ït's a Draw!!!"); | |
| } | |
| // Moves if 4 is user make 5 comp | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == "" && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#5").text(comp); | |
| } | |
| // 4 aand 1 | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#2").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == comp){ | |
| alert("Computer Wins!!!") | |
| } | |
| // 4 aand 6 | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#2").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| alert("Computer Wins!!!") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| alert("Two ways for me") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| alert("Computer Wins") | |
| $("#7").text(comp); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == ""){ | |
| alert("Computer Wins") | |
| $("#1").text(comp); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == user){ | |
| alert("Computer Wins") | |
| $("#7").text(comp); | |
| } | |
| ///4 and 7 | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#1").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("COmputer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("COmputer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("COmputer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("COmputer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#2").text(comp); | |
| alert("Computer Wins!!!") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#2").text(comp); | |
| alert("Computer Wins!!!") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Its a Draw") | |
| } | |
| ///4 and 8 | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#1").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#6").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| alert("Draw") | |
| } | |
| ///4 and 8 | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#2").text(comp); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#2").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| alert("Computer Wins!"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| alert("Computer Wins!"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| alert("Computer Wins!"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| alert("Computer Wins!!!"); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#6").text(comp); | |
| } | |
| // Moves if 5 is user make 1 comp | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#1").text(comp); | |
| } | |
| // 5 and 2 | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| } | |
| // begin here | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == comp && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| alert("Two ways baby"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == comp && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#4").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == comp && $("#9").text() == ""){ | |
| $("#6").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == comp && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Ït's a draw") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Draw!") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Draw") | |
| } | |
| //continue | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == comp && $("#9").text() == ""){ | |
| $("#4").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == user && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == comp && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == comp && $("#5").text() == user && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == comp && $("#5").text() == user && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == comp && $("#5").text() == user && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Ït's a draw") | |
| } | |
| //continue | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| } | |
| // 5 1 7 4 | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == ""){ | |
| $("#6").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Draw"); | |
| } | |
| // 5 1 7 6 | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == ""){ | |
| $("#4").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == comp && $("#5").text() == user && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Draw"); | |
| } | |
| // 5 1 7 9 | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#4").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == comp && $("#5").text() == user && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Draw"); | |
| } | |
| //continue 5 1 9 | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#4").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#4").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#6").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("draw") | |
| } | |
| // 5 and 2 | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#4").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#4").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#4").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#4").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#6").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == user){ | |
| alert("Draw"); | |
| } | |
| //continue | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#2").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| alert("Draw"); | |
| } | |
| //continue | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Draw"); | |
| } | |
| // 5 and 4 | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#6").text(comp); | |
| } | |
| //5 4 6 1 | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == comp && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Draw!!"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Draw"); | |
| } | |
| //5 4 3 | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| } | |
| //here again | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#2").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| alert("Draw") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == comp && $("#9").text() == ""){ | |
| alert("Draw") | |
| } | |
| // 5 4 | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| alert("Two ways baby") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| alert("Computer Wins!!!") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#2").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#2").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| lert("Draw") | |
| } | |
| // 5 4 6 | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#2").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == user){ | |
| $("#2").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == "" && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| } | |
| //continue 5 4 6 1 | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#4").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == comp && $("#5").text() == user && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == user && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == comp && $("#5").text() == user && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == comp && $("#5").text() == user && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == comp && $("#5").text() == user && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == comp && $("#4").text() == comp && $("#5").text() == user && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#2").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == comp && $("#4").text() == comp && $("#5").text() == user && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#2").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == comp && $("#5").text() == user && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == comp && $("#5").text() == user && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Draw") | |
| } | |
| // 5 and 7 | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#2").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#2").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#2").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#2").text(comp); | |
| alert("Computer Wins"); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == ""){ | |
| $("#6").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Draw") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == ""){ | |
| $("#4").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == comp && $("#5").text() == user && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Draw") | |
| } | |
| /// 5 8 | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#2").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#7").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#4").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#4").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#4").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#6").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| alert("Draw") | |
| } | |
| // 5 and 9 | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#4").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#4").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#4").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#4").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == user && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#6").text(comp); | |
| } | |
| // 5 9 1 | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Draw") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#2").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| alert("Draw") | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == user && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#").text(comp); | |
| } | |
| // Moves if 6 is user make 5 comp | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == "" && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#5").text(comp); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#2").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#8").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| alert("Computer Wins!") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#4").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| alert("Draw") | |
| } | |
| // continue | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#1").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| alert("Draw") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#1").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == comp && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| alert("Draw") | |
| } | |
| // Moves if 7 is user 5 make comp | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == "" && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == ""){ | |
| $("#5").text(comp); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#1").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#1").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#1").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#1").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#4").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#6").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#6").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == comp && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#6").text(comp); | |
| } | |
| // 7 and 9 | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#2").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#2").text(comp); | |
| alert("COmputer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#2").text(comp); | |
| alert("COmputer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#2").text(comp); | |
| alert("COmputer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#6").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#4").text(comp); | |
| alert("Computer") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#4").text(comp); | |
| alert("Computer") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#1").text(comp); | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| alert("Draw") | |
| } | |
| // Moves if 8 is user 5 make comp | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == "" && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#5").text(comp); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == ""){ | |
| $("#9").text(comp); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#1").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#1").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#1").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#1").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#7").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == comp){ | |
| $("#2").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == comp && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == comp){ | |
| alert("Draw") | |
| } | |
| // Moves if 9 is user make 5 comp | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == "" && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#5").text(comp); | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == "" && $("#9").text() == user){ | |
| $("#8").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == comp && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#2").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == comp && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == user && $("#8").text() == comp && $("#9").text() == user){ | |
| $("#2").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == "" && $("#8").text() == user && $("#9").text() == user){ | |
| $("#7").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == "" && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == user && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#3").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == "" && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#6").text(comp); | |
| } | |
| else if($("#1").text() == user && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#4").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == user && $("#3").text() == user && $("#4").text() == "" && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#4").text(comp); | |
| alert("Computer Wins") | |
| } | |
| else if($("#1").text() == "" && $("#2").text() == "" && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| $("#1").text(comp) | |
| } | |
| else if($("#1").text() == comp && $("#2").text() == user && $("#3").text() == user && $("#4").text() == user && $("#5").text() == comp && $("#6").text() == comp && $("#7").text() == comp && $("#8").text() == user && $("#9").text() == user){ | |
| alert("Draw") | |
| } | |
| } | |
| function reset(){ | |
| $(".square").text(null) | |
| } | |
| $('#reset').click(function(){ | |
| reset(); | |
| }) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.0/jquery-ui.min.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| html { | |
| margin: 0; | |
| padding: 0; | |
| } | |
| .square { | |
| background-color: red; | |
| width: 100px; | |
| height: 100px; | |
| border: 2px solid white; | |
| font-size: 4em; | |
| text-align: center; | |
| cursor: pointer; | |
| color: white; | |
| } | |
| table { | |
| margin: 50px auto; | |
| border: 10px solid white; | |
| box-shadow: 10px 10px 30px #333; | |
| font-family: "Satisfy", sans-serif; | |
| } | |
| .btn { | |
| margin: 10px auto; | |
| } | |
| #user { | |
| background-color: rgba(0, 0, 0, .5); | |
| width: 500px; | |
| height: 200px; | |
| margin: 50px auto; | |
| border-radius: 10px; | |
| } | |
| #x, | |
| #o { | |
| font-size: 3em; | |
| padding: 20px; | |
| width: 100px; | |
| margin-top: 50px; | |
| margin-left: 50px; | |
| margin-right: 50px; | |
| } | |
| footer { | |
| font-size: 1.1em; | |
| } | |
| @media only screen and (max-width: 500px) { | |
| #user { | |
| width: 80%; | |
| } | |
| #x, | |
| #o { | |
| margin-left: 30px; | |
| margin-right: 30px; | |
| } | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" /> | |
| <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" /> | |
| <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment