| 452 | } |
| 453 | |
| 454 | function checkBoardForFinalWin() { |
| 455 | //weed out non wins |
| 456 | for (var i = 0; i < 81; i++) { |
| 457 | if (board.board[i].val == ' ') { |
| 458 | return |
| 459 | }; |
| 460 | } |
| 461 | |
| 462 | function rndRGB() { |
| 463 | return Math.floor(Math.random() * 255); |
| 464 | } |
| 465 | |
| 466 | function yayIWon() { |
| 467 | document.body.style.backgroundColor = "rgb(" + rndRGB() + "," + rndRGB() + "," + rndRGB() + ")"; |
| 468 | } |
| 469 | |
| 470 | document.getElementsByTagName('h1')[0].innerHTML = "CONGRATULATIONS!!! You Win!!!" |
| 471 | |
| 472 | var pleaseStop = window.setInterval(yayIWon, 500); |
| 473 | window.setTimeout(function() { |
| 474 | clearInterval(pleaseStop); |
| 475 | document.body.style.backgroundColor = "#e5ecf3"; |
| 476 | }, 10000); |
| 477 | } |
| 478 | |
| 479 | //===================== |
| 480 | |