From 8b5eafb3448b5f63ddc45cd995d462c54ab42858 Mon Sep 17 00:00:00 2001 From: Lance Hammond Jr <40966265+lancehammondjr@users.noreply.github.com> Date: Tue, 21 Apr 2020 17:09:45 -0500 Subject: [PATCH] Revert "Tic tac toe" --- 03week/index.html | 28 ---------------------------- 03week/style.css | 32 -------------------------------- 03week/ticTacToe.js | 42 ------------------------------------------ 3 files changed, 102 deletions(-) delete mode 100644 03week/index.html delete mode 100644 03week/style.css diff --git a/03week/index.html b/03week/index.html deleted file mode 100644 index 24ef230ce..000000000 --- a/03week/index.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - Document - - -
-

Tic Tac Toe

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
\ No newline at end of file diff --git a/03week/style.css b/03week/style.css deleted file mode 100644 index 0258ac244..000000000 --- a/03week/style.css +++ /dev/null @@ -1,32 +0,0 @@ -.container { - width: 320px; - height: 320px; - margin: auto; - margin-top: 100px; -} - -h1 { - text-align: center; - font-size: 50px; -} -.row { - height: 100px; -} -.column { - height: 100px; - width: 100px; - float: left; - font-size: 100px; - text-align: center; - line-height: 100px; -} -.column:hover { - background-color: lightgrey; -} - -.borderB { - border-bottom: 10px solid black; -} -.borderR { - border-right: 10px solid black; -} \ No newline at end of file diff --git a/03week/ticTacToe.js b/03week/ticTacToe.js index 9ea72dae9..1abf5b900 100644 --- a/03week/ticTacToe.js +++ b/03week/ticTacToe.js @@ -25,64 +25,22 @@ function printBoard() { function horizontalWin() { // Your code here - for (let i=0; i<3; i++){ - if (board[i][0] == board[i][1] && board[i][1] == board[i][2] && board[i][0] != ' '){ - //console.log("horizontalWin") - return true; - } - } - return false; } function verticalWin() { // Your code here - for (let i=0; i<3; i++){ - if (board[0][i] == board[1][i] && board[1][i] == board[2][i] && board[0][i] != ' '){ - //console.log(verticalWin) - return true; - } - } - return false; } function diagonalWin() { // Your code here - if (board[0][0] == board[1][1] && board[1][1] == board[2][2] && board[0][0] != ' '){ - return true; - } - if (board[2][0] == board[1][1] && board[1][1] == board[0][2] && board[2][0] != ' '){ - return true; - } - return false; } function checkForWin() { // Your code here - if (horizontalWin()){ - console.log(playerTurn + " Wins!"); - console.log("horizontalWin"); - } - if (verticalWin()){ - console.log(playerTurn + " Wins!"); - console.log("verticalWin"); - } - if(diagonalWin()){ - console.log(playerTurn + " Wins!"); - console.log("diagonalWin"); - } - return true; } function ticTacToe(row, column) { // Your code here - board[row][column] = playerTurn; - checkForWin(); - if(playerTurn == "X"){ - playerTurn = "O"; - } - else{ - playerTurn = "X"; - } } function getPrompt() {