Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function checkGameEnd(winner) { //проверяем, не закончена ли игра
- if ((window.cells[0] == true) && (window.cells[1] == true) && (window.cells[2] == true)) ||
- ((window.cells[0] == true) && (window.cells[3] == true) && (window.cells[6] == true)) ||
- ((window.cells[0] == true) && (window.cells[4] == true) && (window.cells[8] == true)) ||
- ((window.cells[1] == true) && (window.cells[4] == true) && (window.cells[7] == true)) ||
- ((window.cells[2] == true) && (window.cells[5] == true) && (window.cells[8] == true)) ||
- ((window.cells[2] == true) && (window.cells[4] == true) && (window.cells[6] == true)) ||
- ((window.cells[3] == true) && (window.cells[4] == true) && (window.cells[5] == true)) ||
- ((window.cells[6] == true) && (window.cells[7] == true) && (window.cells[8] == true)) {
- document.getElementById('result').innerHTML = winner;
- document.getElementById('result').appendChild(document.createTextNode(' won!'));
- }
- }
Add Comment
Please, Sign In to add comment