Advertisement
drunkspinda02

index

Mar 26th, 2019
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.01 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Jogo do galo</title>
  5. <meta charset="utf-8">
  6. <style type="text/css">
  7.  
  8. body{
  9. background-color: blue;
  10. color: black;
  11. font-family: "Times New Roman", Times, serif;
  12. background-image: url("imagemcic/galo.jpg");
  13. }
  14.  
  15. .galo,.fila{
  16. border: 1px solid white;
  17. margin: auto;
  18. border-collapse: collapse;
  19. background-color: green;
  20. text-align: center;
  21.  
  22. }
  23.  
  24.  
  25.  
  26. .galo{
  27. width: 300px;
  28. height: 300px;
  29. color: white;
  30. }
  31.  
  32. p{
  33. text-align: center;
  34. font-family: "Times New Roman", Times, serif;
  35. color: black;
  36. }
  37.  
  38. input{
  39. border-radius: 15px;
  40. }
  41.  
  42. input[type=button]{
  43. width: 150px;
  44. height: 27px;
  45. border-color: black;
  46. font-family: "Times New Roman", Times, serif;
  47. font-size: 20px;
  48. }
  49.  
  50. input[type=text]{
  51. text-align: center;
  52. border-color: black;
  53. font-family: "Times New Roman", Times, serif;
  54. }
  55.  
  56. .off{
  57. background-color: brown;
  58. border: 1px solid white;
  59. border-collapse: collapse;
  60. width: 100px;
  61. height: 100px;
  62. }
  63.  
  64. .on{
  65. background-color: green;
  66. border: 1px solid white;
  67. border-collapse: collapse;
  68. width: 100px;
  69. height: 100px;
  70. }
  71.  
  72. .naoganhou{
  73. display: none;
  74. }
  75.  
  76. .leaderboard{
  77. display: inline;
  78. }
  79.  
  80. .ganhou{
  81. background-color: yellow;
  82. border: 1px solid black;
  83. color: black;
  84. width: 50%;
  85. margin: auto;
  86. background-image: url("imagemcic/ganhou.jpg");
  87. }
  88.  
  89. </style>
  90. </head>
  91. <body>
  92. <?php
  93.  
  94. $msg="";
  95. $turnbd = new mysqli('localhost','usr21','dacic2019','usr21');
  96.  
  97. if ($turnbd->connect_error) {
  98. die('Erro na ligação : ('. $turnbd->connect_errno .') '. $turnbd->connect_error);
  99.  
  100. }
  101.  
  102. //Inserçao
  103.  
  104. if(isset($_POST['inserir'])){
  105.  
  106. $query = "INSERT INTO a11680_resultados(numaluno,nickname,tempo) VALUES(?,?,?)";
  107.  
  108.  
  109. if ($_POST['numero']=='' || $_POST['nick']=='' || $_POST['tempo']=='') {
  110. $msg="Existem campos que nao foram preenchidos!";
  111. }
  112.  
  113. else{
  114.  
  115.  
  116. $statement = $turnbd->prepare($query);
  117.  
  118. $statement->bind_param('iss', $_POST["numero"],
  119. $_POST["nick"],
  120. $_POST["tempo"]);
  121. $statement->execute();
  122.  
  123. if ($statement->affected_rows>0){
  124. $msg="O seu registo foi inserido!";
  125. }
  126. else{
  127. die('Erro: ('. $turnbd->errno .') '. $turnbd->error);
  128. }
  129. $statement->close();
  130.  
  131. }
  132.  
  133. $turnbd->close();
  134. }
  135.  
  136.  
  137.  
  138. ?>
  139. <h1 style="text-align: center; text-shadow: 2px 2px grey;">Jogo do Galo</h1>
  140. <h2 style="text-align: center; text-shadow: 2px 2px grey;">Contra o CPU</h2>
  141. <div class="naoganhou" id="leaderboard">
  142. <?php
  143. $query = "SELECT numaluno,nickname,tempo FROM a11680_resultados ORDER BY tempo ";
  144. $statement = $turnbd->prepare($query);
  145. $statement->execute();
  146. $statement->bind_result($tnumero,$tnick,$ttempo);
  147.  
  148.  
  149. echo '<table style=" color: black; border: 2px solid black; margin: auto; border-collapse: collapse; background-color: white;" width="50%">';
  150. echo '<tr style="background-color:#F7FE2E; border: 2px solid black; border-collapse: collapse; text-align: center;">';
  151. echo '<td style="background-color:#F7FE2E; border: 2px solid black; border-collapse: collapse; text-align: center;">Numero</td>';
  152. echo '<td style="background-color:#F7FE2E; border: 2px solid black; border-collapse: collapse; text-align: center;">Nickname</td>';
  153. echo '<td style="background-color:#F7FE2E; border: 2px solid black; border-collapse: collapse; text-align: center;">Tempo</td>';
  154. echo "</tr>";
  155. while ($statement->fetch()) {
  156. echo '<tr style="text-align: center;">';
  157. echo "<td style='border: 2px solid black; border-collapse: collapse;'>$tnumero</td>";
  158. echo "<td style='border: 2px solid black; border-collapse: collapse;'>$tnick</td>";
  159. echo "<td style='border: 2px solid black; border-collapse: collapse;'>$ttempo</td>";
  160. echo "</tr>";
  161. }
  162. echo "</table><br>";
  163. $statement->close();
  164. $turnbd->close();
  165. $tnumero=$tnick=$ttempo='';
  166.  
  167. ?>
  168. </div>
  169. <div class="naoganhou" id="vitoria">
  170. <h1 style="text-align: center; text-shadow: 2px 2px grey;">PARABÉNS, VOCÊ GANHOU!!!</h1>
  171. <form class="" action="" method="post">
  172. <p style="text-align:center; "><h3 style="text-align:center;">Introduza aqui o seu numero de aluno numero de aluno:</h3></p>
  173. <p style="text-align:center; "><input type="text" name="numero" value="" placeholder="Numero" ></p>
  174. <p style="text-align:center; "><h3 style="text-align:center;">Introduza aqui o seu nickname:</h3> </p>
  175. <p style="text-align:center; "><input type="text" name="nick" value="" placeholder="Nome" ></p>
  176. <p style="text-align:center; "><h3 style="text-align:center;">O seu tempo:</h3></p>
  177. <p style="text-align:center; "><input type="text" name="tempo" value="" id="tempo" readonly=""></p>
  178. <p style="text-align:center; "><input class="" name="inserir" type="submit" value="Enviar Resultados"></p>
  179. </form>
  180. </div>
  181. <p><?php echo $msg; ?></p>
  182. <br>
  183. <br>
  184. <table class="galo">
  185. <tr class="fila">
  186. <td class="off" id="a1" onclick="marca('a1');">&nbsp;</td>
  187. <td class="off" id="a2" onclick="marca('a2');">&nbsp;</td>
  188. <td class="off" id="a3" onclick="marca('a3');">&nbsp;</td>
  189. </tr>
  190. <tr class="fila">
  191. <td class="off" id="a4" onclick="marca('a4');">&nbsp;</td>
  192. <td class="off" id="a5" onclick="marca('a5');">&nbsp;</td>
  193. <td class="off" id="a6" onclick="marca('a6');">&nbsp;</td>
  194. </tr>
  195. <tr class="fila">
  196. <td class="off" id="a7" onclick="marca('a7');">&nbsp;</td>
  197. <td class="off" id="a8" onclick="marca('a8');">&nbsp;</td>
  198. <td class="off" id="a9" onclick="marca('a9');">&nbsp;</td>
  199. </tr>
  200. </table>
  201. <p><input type="button" name="start" value="Start" id="start" onclick="start();interval();"></p>
  202. <p><input type="button" name="reset" value="Reset" id="reset" onclick="limpa()"></p>
  203. <div style="background-color: yellow; border: 2px solid black; width: 20%; margin:auto; ">
  204. <h1 style="text-align: center; color: black;" id="cronometro">00 : 00 : 00 : 00</h1>
  205. </div>
  206. <p><input style="border-radius: 0px; width: 200px; height:65px; font-size: 30px;" onclick="leaderboard()" type="button" name="leaderboard" value="Leaderboard" id="leaderboard"></p>
  207.  
  208.  
  209. <!--<p>Jogador<br><input type="text" name="jg1" id="jg1" value="0"></p>
  210. <p>CPU<br><input type="text" name="jg2" id="jg2" value="0"></p>
  211. <p>Empate<br><input type="text" name="emp" id="emp" value="0"></p>-->
  212.  
  213. <script type="text/javascript">
  214. var j=0;
  215. var i,b,c,j,w;
  216. var win=0;
  217. var jogada=0;
  218. var k =0;
  219. var linhascpu;
  220. var linhasplayer;
  221. var board = [0, 0, 0, 0, 0, 0, 0, 0, 0];
  222.  
  223. var cs = 0;
  224. var s = 0;
  225. var m = 0;
  226. var h = 0;
  227. var mcs = 0;
  228. var ms = 0;
  229. var mm = 0;
  230. var mh = 0;
  231. var form=document.getElementById('form');
  232.  
  233. function leaderboard(){
  234.  
  235. if(document.getElementById('leaderboard').className== 'leaderboard'){
  236. document.getElementById('leaderboard').className= 'naoganhou';
  237. }
  238.  
  239. else{
  240. document.getElementById('leaderboard').className= 'leaderboard';
  241. }
  242.  
  243. }
  244.  
  245. function interval() {
  246. intervalo= setInterval(cron,10);
  247. }
  248.  
  249. function start(){
  250. document.getElementById('vitoria').className= "naoganhou";
  251. for(i=1;i<=9;i++){
  252. if(document.getElementById('a' +i).className= "off"){
  253. document.getElementById('a' +i).className= "on"
  254. }
  255. }
  256. }
  257.  
  258. function cron() {
  259.  
  260. cs++;
  261.  
  262. if (cs == 100 ) {
  263. s++; cs=0;
  264. }
  265. if (s == 60) {
  266. m++; s = 0;
  267. }
  268. if (m == 60) {
  269. h++; s = 0; m = 0;
  270. }
  271.  
  272.  
  273. if (cs<10) {
  274. mcs= "0" + cs
  275. }
  276. else{
  277. mcs= cs
  278. }
  279.  
  280. if (s<10) {
  281. ms= "0" + s
  282. }
  283. else{
  284. ms=s
  285. }
  286.  
  287. if (m<10) {
  288. mm= "0" + m
  289. }
  290. else{
  291. mm=m
  292. }
  293.  
  294. if (h<10) {
  295. mh= "0" + h
  296. }
  297. else{
  298. mh=h
  299. }
  300.  
  301.  
  302. document.getElementById('cronometro').innerHTML= mh + " : " + mm + " : " + ms + " : " + mcs;
  303.  
  304. }
  305.  
  306. function recomeçar(){
  307. s=0;
  308. cs=0;
  309. m=0;
  310. h=0;
  311. document.getElementById('cronometro').innerHTML= "00 : 00 : 00 : 00"
  312. clearInterval(intervalo);
  313. }
  314.  
  315.  
  316. function marca(x){
  317. if (win==0 && k==0) {
  318. if(document.getElementById(x).innerHTML=='&nbsp;' && document.getElementById(x).className== "on"){
  319. document.getElementById(x).innerHTML='X';
  320. for (i=1;i<=9;i++){
  321. if(document.getElementById('a' +i).innerHTML=='X'){
  322. board[i-1]=1;
  323. }
  324. }
  325. jogada++;
  326. k=1;
  327. verifica();
  328. }
  329.  
  330. else{
  331. alert('Não pode clickar nesta casa.')
  332. }
  333.  
  334.  
  335.  
  336.  
  337.  
  338. if (jogada<9 && win==0 && k==1 /*&& modojogo==2*/) {
  339.  
  340. if (jogada==1 && k==1) {
  341. if (board[4]==1) {
  342. board[6]=2;
  343. console.log(board);
  344. jogada++;
  345. document.getElementById('a7').innerHTML='O';
  346. k=0;
  347. verifica();
  348. }
  349. else{
  350. board[4]=2;
  351. console.log(board);
  352. jogada++;
  353. document.getElementById('a5').innerHTML='O';
  354. k=0;
  355. verifica();
  356. }
  357. }
  358.  
  359. if (jogada==3 && k==1) {
  360. if (board[2]==1 && board[6]==1 || board[0]==1 && board[8]==1) {
  361. board[7]=2;
  362. console.log(board);
  363. jogada++;
  364. document.getElementById('a8').innerHTML='O';
  365. k=0;
  366. verifica();
  367. }
  368. else if(board[4]==1 && board[2]==1 || board[4]==1 && board[0]==1 || board[4]==1 && board[8]==1){
  369. if (board[8]==0) {
  370. board[8]=2;
  371. console.log(board);
  372. jogada++;
  373. document.getElementById('a9').innerHTML='O';
  374. k=0;
  375. verifica();
  376. }
  377. else if (board[0]==0) {
  378. board[0]=2;
  379. console.log(board);
  380. jogada++;
  381. document.getElementById('a1').innerHTML='O';
  382. k=0;
  383. verifica();
  384. }
  385.  
  386. }
  387.  
  388. }
  389.  
  390.  
  391. if (k==1) {
  392. for(i=0,b=3,c=6;i<=3;i++,b++,c++){
  393. if(board[i]==board[b] && board[i]!=0 || board[i]==board[c] && board[i]!=0 || board[b]==board[c] && board[b]!=0){
  394. if (board[i]==0) {
  395. board[i]=2;
  396. console.log(board);
  397. jogada++;
  398. document.getElementById('a'+(i+1)).innerHTML='O';
  399. k=0;
  400. verifica();
  401. }
  402. else if (board[b]==0) {
  403. board[b]=2;
  404. console.log(board);
  405. jogada++;
  406. document.getElementById('a'+(b+1)).innerHTML='O';
  407. k=0;
  408. verifica();
  409. }
  410. else if (board[c]==0) {
  411. board[c]=2;
  412. console.log(board);
  413. jogada++;
  414. document.getElementById('a'+(c+1)).innerHTML='O';
  415. k=0;
  416. verifica();
  417. }
  418. }
  419. }
  420. }
  421.  
  422. if (k==1) {
  423. for(i=0,b=1,c=2;i<=6;i=i+3,b=b+3,c=c+3){
  424. if(board[i]==board[b] && board[i]!=0 || board[i]==board[c] && board[i]!=0 || board[b]==board[c] && board[b]!=0){
  425. if (board[i]==0) {
  426. board[i]=2;
  427. console.log(board);
  428. jogada++;
  429. document.getElementById('a'+(i+1)).innerHTML='O';
  430. k=0;
  431. verifica();
  432. }
  433. else if (board[b]==0) {
  434. board[b]=2;
  435. console.log(board);
  436. jogada++;
  437. document.getElementById('a'+(b+1)).innerHTML='O';
  438. k=0;
  439. verifica();
  440. }
  441. else if (board[c]==0) {
  442. board[c]=2;
  443. console.log(board);
  444. jogada++;
  445. document.getElementById('a'+(c+1)).innerHTML='O';
  446. k=0;
  447. verifica();
  448. }
  449. }
  450. }
  451. }
  452.  
  453. if (k==1) {
  454. if (board[0]==board[4] && board[0]!=0 || board[0]==board[8] && board[0]!=0 || board[4]==board[8] && board[4]!=0){
  455. if (board[0]==0) {
  456. board[0]=2;
  457. console.log(board);
  458. jogada++;
  459. document.getElementById('a1').innerHTML='O';
  460. k=0;
  461. verifica();
  462. }
  463. else if (board[4]==0) {
  464. board[4]=2;
  465. console.log(board);
  466. jogada++;
  467. document.getElementById('a5').innerHTML='O';
  468. k=0;
  469. verifica();
  470. }
  471. else if (board[8]==0) {
  472. board[8]=2;
  473. console.log(board);
  474. jogada++;
  475. document.getElementById('a9').innerHTML='O';
  476. k=0;
  477. verifica();
  478. }
  479. }
  480. }
  481.  
  482. if (k==1) {
  483. if (board[2]==board[4] && board[2]!=0 || board[2]==board[6] && board[2]!=0 || board[4]==board[6] && board[4]!=0){
  484. if (board[2]==0) {
  485. board[2]=2;
  486. console.log(board);
  487. jogada++;
  488. document.getElementById('a3').innerHTML='O';
  489. k=0;
  490. verifica();
  491. }
  492. else if (board[4]==0) {
  493. board[4]=2;
  494. console.log(board);
  495. jogada++;
  496. document.getElementById('a5').innerHTML='O';
  497. k=0;
  498. verifica();
  499. }
  500. else if (board[6]==0) {
  501. board[6]=2;
  502. console.log(board);
  503. jogada++;
  504. document.getElementById('a7').innerHTML='O';
  505. k=0;
  506. verifica();
  507. }
  508. }
  509. }
  510.  
  511. if(k==1){
  512. do{
  513. c=Math.floor((Math.random()*9)+1);
  514. }while (document.getElementById('a' + c ).innerHTML!='&nbsp;' && document.getElementById(x).className== "on");
  515. board[c-1]=2;
  516. console.log(board);
  517. jogada++;
  518. document.getElementById('a'+c).innerHTML='O';
  519. k=0;
  520. verifica();
  521. }
  522.  
  523.  
  524. }
  525.  
  526. }
  527. }
  528.  
  529. /*if (jogada<9 && win==0 && k==1 && modojogo==1){
  530. if(document.getElementById(x).innerHTML=='&nbsp;' && document.getElementById(x).className== "on"){
  531. document.getElementById(x).innerHTML='O';
  532. for (i=1;i<=9;i++){
  533. if(document.getElementById('a' +i).innerHTML=='O'){
  534. board[i-1]=1;
  535. }
  536. }
  537. jogada++;
  538. k=0;
  539. verifica();
  540. }
  541.  
  542. else{
  543. alert('Não pode clickar nesta casa.')
  544. }
  545. }*/
  546.  
  547.  
  548. function verifica(){
  549.  
  550. for(i=1,b=4,c=7;i<=3;i++,b++,c++){
  551. if(win==0){
  552. if (document.getElementById('a' + i).innerHTML==document.getElementById('a' + b).innerHTML && document.getElementById('a' + i).innerHTML== document.getElementById('a' + c).innerHTML && document.getElementById('a' + i).innerHTML!='&nbsp;') {
  553. if(document.getElementById('a'+i).innerHTML=='X'){
  554. alert('Jogador venceu!');
  555. //document.getElementById('jg1').value=parseInt(document.getElementById('jg1').value) + 1;
  556. win=1;
  557. board = [0, 0, 0, 0, 0, 0, 0, 0, 0];
  558. for(i=1;i<=9;i++){
  559. if(document.getElementById('a' +i).className= "on"){
  560. document.getElementById('a' +i).className= "off";
  561. }
  562. }
  563. document.getElementById('vitoria').className= "ganhou";
  564. document.getElementById('tempo').value=mh + " : " + mm + " : " + ms + " : " + mcs;
  565. limpa();
  566. recomeçar();
  567.  
  568. }
  569. else
  570. if(document.getElementById('a'+i).innerHTML=='O'){
  571. alert('CPU venceu!');
  572. //document.getElementById('jg2').value=parseInt(document.getElementById('jg2').value) + 1;
  573. win=1;
  574. board = [0, 0, 0, 0, 0, 0, 0, 0, 0];
  575. for(i=1;i<=9;i++){
  576. if(document.getElementById('a' +i).className= "on"){
  577. document.getElementById('a' +i).className= "off";
  578. }
  579. }
  580. limpa();
  581. recomeçar();
  582. }
  583. }
  584. }
  585. }
  586.  
  587. for(i=1,b=2,c=3;i<=7;i=i+3,b=b+3,c=c+3){
  588. if(win==0){
  589. if (document.getElementById('a' + i).innerHTML==document.getElementById('a' + b).innerHTML && document.getElementById('a' + i).innerHTML== document.getElementById('a' + c).innerHTML && document.getElementById('a' + i).innerHTML!='&nbsp;') {
  590. if(document.getElementById('a'+i).innerHTML=='X'){
  591. alert('Jogador venceu!');
  592. //document.getElementById('jg1').value=parseInt(document.getElementById('jg1').value) + 1;
  593. win=1;
  594. board = [0, 0, 0, 0, 0, 0, 0, 0, 0];
  595. for(i=1;i<=9;i++){
  596. if(document.getElementById('a' +i).className= "on"){
  597. document.getElementById('a' +i).className= "off";
  598. }
  599. }
  600. document.getElementById('vitoria').className= "ganhou";
  601. document.getElementById('tempo').value=mh + " : " + mm + " : " + ms + " : " + mcs;
  602. limpa();
  603. recomeçar();
  604.  
  605. }
  606. else
  607. if(document.getElementById('a'+i).innerHTML=='O'){
  608. alert('CPU venceu!');
  609. //document.getElementById('jg2').value=parseInt(document.getElementById('jg2').value) + 1;
  610. win=1;
  611. board = [0, 0, 0, 0, 0, 0, 0, 0, 0];
  612. for(i=1;i<=9;i++){
  613. if(document.getElementById('a' +i).className= "on"){
  614. document.getElementById('a' +i).className= "off";
  615. }
  616. }
  617. limpa();
  618. recomeçar();
  619. }
  620. }
  621.  
  622. }
  623. }
  624.  
  625. if(win==0){
  626. if(document.getElementById('a1').innerHTML== document.getElementById('a5').innerHTML && document.getElementById('a1').innerHTML==document.getElementById('a9').innerHTML && document.getElementById('a1').innerHTML!='&nbsp;'){
  627. if(document.getElementById('a1').innerHTML=='X' && document.getElementById('a5').innerHTML=='X' && document.getElementById('a9').innerHTML=='X' ){
  628. alert('Jogador venceu!');
  629. //document.getElementById('jg1').value=parseInt(document.getElementById('jg1').value) + 1;
  630. win=1;
  631. board = [0, 0, 0, 0, 0, 0, 0, 0, 0];
  632. for(i=1;i<=9;i++){
  633. if(document.getElementById('a' +i).className= "on"){
  634. document.getElementById('a' +i).className= "off";
  635. }
  636. }
  637. document.getElementById('vitoria').className= "ganhou";
  638. document.getElementById('tempo').value=mh + " : " + mm + " : " + ms + " : " + mcs;
  639. limpa();
  640. recomeçar();
  641.  
  642. }
  643. else
  644. if(document.getElementById('a1').innerHTML=='O' && document.getElementById('a5').innerHTML=='O' && document.getElementById('a9').innerHTML=='O' ){
  645. alert('CPU venceu!');
  646. //document.getElementById('jg2').value=parseInt(document.getElementById('jg2').value) + 1;
  647. win=1;
  648. board = [0, 0, 0, 0, 0, 0, 0, 0, 0];
  649. for(i=1;i<=9;i++){
  650. if(document.getElementById('a' +i).className= "on"){
  651. document.getElementById('a' +i).className= "off";
  652. }
  653. }
  654. limpa();
  655. recomeçar();
  656. }
  657.  
  658. }
  659. }
  660.  
  661. if(win==0){
  662. if(document.getElementById('a3').innerHTML== document.getElementById('a5').innerHTML && document.getElementById('a3').innerHTML==document.getElementById('a7').innerHTML && document.getElementById('a3').innerHTML!='&nbsp;'){
  663. if(document.getElementById('a3').innerHTML=='X' && document.getElementById('a5').innerHTML=='X' && document.getElementById('a7').innerHTML=='X' ){
  664. alert('Jogador venceu!');
  665. //document.getElementById('jg1').value=parseInt(document.getElementById('jg1').value) + 1;
  666. win=1;
  667. board = [0, 0, 0, 0, 0, 0, 0, 0, 0];
  668. for(i=1;i<=9;i++){
  669. if(document.getElementById('a' +i).className= "on"){
  670. document.getElementById('a' +i).className= "off";
  671. }
  672. }
  673. document.getElementById('vitoria').className= "ganhou";
  674. document.getElementById('tempo').value=mh + " : " + mm + " : " + ms + " : " + mcs;
  675. limpa();
  676. recomeçar();
  677.  
  678. }
  679. else
  680. if(document.getElementById('a3').innerHTML=='O' && document.getElementById('a5').innerHTML=='O' && document.getElementById('a7').innerHTML=='O' ){
  681. alert('CPU venceu!');
  682. //document.getElementById('jg2').value=parseInt(document.getElementById('jg2').value) + 1;
  683. win=1;
  684. board = [0, 0, 0, 0, 0, 0, 0, 0, 0];
  685. for(i=1;i<=9;i++){
  686. if(document.getElementById('a' +i).className= "on"){
  687. document.getElementById('a' +i).className= "off";
  688. }
  689. }
  690. limpa();
  691. recomeçar();
  692. }
  693. }
  694. }
  695.  
  696. if (win==0 && jogada==9) {
  697. alert('Empate.');
  698. //document.getElementById('emp').value=parseInt(document.getElementById('emp').value) + 1;
  699. board = [0, 0, 0, 0, 0, 0, 0, 0, 0];
  700. for(i=1;i<=9;i++){
  701. if(document.getElementById('a' +i).className= "on"){
  702. document.getElementById('a' +i).className= "off";
  703. }
  704. }
  705. limpa();
  706. recomeçar();
  707.  
  708.  
  709. }
  710. }
  711. function limpa(){
  712. for(i=1;i<=9;i++){
  713. document.getElementById('a' + i).innerHTML='&nbsp;';
  714. }
  715. jogada=0;
  716. win=0;
  717. j=0;
  718. k=0;
  719. board = [0, 0, 0, 0, 0, 0, 0, 0, 0];
  720. s=0;
  721. cs=0;
  722. m=0;
  723. h=0;
  724. document.getElementById('cronometro').innerHTML= "00 : 00 : 00 : 00"
  725. }
  726.  
  727. </script>
  728. </body>
  729. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement