From 1b6ac34461e66ebd8c5a297487ae2e26888196a5 Mon Sep 17 00:00:00 2001 From: Chase Turner Date: Tue, 1 Aug 2017 18:07:51 -0500 Subject: [PATCH 1/2] Changes in tictactoe? --- 02week/ticTacToe.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/02week/ticTacToe.js b/02week/ticTacToe.js index 1abf5b900..aeebf2ac6 100644 --- a/02week/ticTacToe.js +++ b/02week/ticTacToe.js @@ -7,9 +7,9 @@ const rl = readline.createInterface({ output: process.stdout }); let board = [ - [' ', ' ', ' '], - [' ', ' ', ' '], - [' ', ' ', ' '] + array1: [' ', ' ', ' '], + array2: [' ', ' ', ' '], + array3: [' ', ' ', ' '] ]; let playerTurn = 'X'; @@ -25,14 +25,27 @@ function printBoard() { function horizontalWin() { // Your code here + if (array1===[x,x,x]||[o,o,o]){ + return "Win!"; + }else if (array2===[x,x,x]||[o,o,o]) { + return "Win!" + }else if (array3===[x,x,x]||[o,o,o]) { + return "Win!" + } } function verticalWin() { // Your code here + if (array1[0]===x||o && array2[0]===x||o && array3[0]===x||0){ + return "Win!" + } } function diagonalWin() { // Your code here + if (array1[0]===x||o && array2[1]===x||o && array3[2]===x||o){ + return "Win!" + } } function checkForWin() { From 0cc83441dec0f8f823c3cb95d9b57029b2018bc3 Mon Sep 17 00:00:00 2001 From: Chase Turner Date: Tue, 15 Aug 2017 13:49:17 -0500 Subject: [PATCH 2/2] Pig Latin finished --- 02week/pigLatin.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/02week/pigLatin.js b/02week/pigLatin.js index 046434c94..424acf752 100644 --- a/02week/pigLatin.js +++ b/02week/pigLatin.js @@ -9,10 +9,19 @@ const rl = readline.createInterface({ function pigLatin(word) { - - // Your code here - -} + let inputArray = word.split(''); + let vowelArray = ['a','e','i','o','u']; + for(let i =0; i