From ea3e67d064fa7f934a3c26c8f71ada980e7460fd Mon Sep 17 00:00:00 2001 From: Kimberley Zell Date: Wed, 15 Nov 2017 00:05:22 -0800 Subject: [PATCH 1/7] forgot to commit sooner --- package-lock.json | 123 ++++++++++++++++++++++++++++++++++++++++++ scrabble.js | 112 ++++++++++++++++++++++++++++++++++++-- spec/scrabble_spec.js | 12 ++--- 3 files changed, 237 insertions(+), 10 deletions(-) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..80043d7 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,123 @@ +{ + "name": "js-scrabble", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "add-matchers": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/add-matchers/-/add-matchers-0.5.0.tgz", + "integrity": "sha1-UCGQ5HUM1XIWGDkyaLYaFXNm52U=" + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "brace-expansion": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "eslint-plugin-jasmine": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-jasmine/-/eslint-plugin-jasmine-2.9.1.tgz", + "integrity": "sha1-IuGaWfFvOl9kOgSroEQ40OMEcDA=" + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=" + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "jasmine": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-2.8.0.tgz", + "integrity": "sha1-awicChFXax8W3xG4AUbZHU6Lij4=", + "requires": { + "exit": "0.1.2", + "glob": "7.1.2", + "jasmine-core": "2.8.0" + } + }, + "jasmine-core": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.8.0.tgz", + "integrity": "sha1-vMl5rh+f0FcB5F5S5l06XWPxok4=" + }, + "jasmine-expect": { + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/jasmine-expect/-/jasmine-expect-3.8.1.tgz", + "integrity": "sha512-klARdR5AVX9nZhHhYDlbDYgxgi6kl9DGS0vguhaioKoSwr8HL1uOQ7FFUBASq/sqBL/s2nkh/1efqZ2ugcknFA==", + "requires": { + "add-matchers": "0.5.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "1.1.8" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1.0.2" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + } + } +} diff --git a/scrabble.js b/scrabble.js index 7a1f161..982800a 100644 --- a/scrabble.js +++ b/scrabble.js @@ -1,14 +1,118 @@ const Scrabble = { + score: function(word) { - // TODO: implement score - } + let scoringHash = { A: 1, E: 1, I: 1, O: 1, U: 1, L: 1, N: 1, + R: 1, S: 1, T: 1, D: 2, G: 2, B: 3, C: 3, + M: 3, P:3, F: 4, H: 4, V: 4, W: 4, Y: 4, K: 5, + J: 8, X: 8, Q: 10, Z: 10 + }; + + let score = 0; + + if (word.length >= 1) { + if ((/^[a-zA-Z]/.test(word)) == false) { + throw('Word must contain only letters A-Z'); + } + } + + let letters = word.toUpperCase().split(''); + + if (letters.length == 7) { + score += 50 + } else if (letters.length > 7) { + throw('Maximum 7 letters are allowed!'); + // } else if (letters.length < 1) { + // throw('No word entered'); + } + + letters.forEach(function(letter) { + if (/^[a-zA-Z]/.test) { + score += scoringHash[letter]; + } else { + throw('Word must contain only letters A-Z') + } + }) - // TODO: add the highestScoreFrom method + return score; +}, + + highestScoreFrom: function(arrayOfWords) { + let highestScoreWord = ''; + if (arrayOfWords.length < 1) { + throw('No words have been played yet'); + } else { + arrayOfWords.forEach(function(word) { + if (Scrabble.score(highestScoreWord) === 0 || Scrabble.score(word) > Scrabble.score(highestScoreWord)) { + highestScoreWord = word; + } + }); + } + return highestScoreWord; + } }; Scrabble.Player = class { - // TODO: implement the Player class + constructor(name) { + this.name = name; + this.plays = []; + // this.totalScore = 0; + + if (name === undefined) { + throw('Player must have a name'); + } + } + + play(word) { + if (this.hasWon()) { + return false + } else { + let wordScore = Scrabble.score(word); + // this.totalScore += wordScore; + this.plays.push(word); + return true; + } + }; + + highestScoringWord(plays) { + return Scrabble.highestScoreFrom(this.plays); + } + + highestWordScore() { + return Scrabble.score(this.highestScoringWord(this.plays)); + } + + hasWon() { + if (this.totalScore >= 100) { + return true; + } else { + return false; + } + } + + totalScore() { + let total = 0; + let allPlays = this.plays + + if (allPlays === undefined) { + return total; + } else { + allPlays.forEach(function(word) { + total += Scrabble.score(word); + }); + } + return total + } + }; module.exports = Scrabble; + + +console.log(Scrabble.score('cat')); + +newPlayer = new Scrabble.Player('Jeff') + +newPlayer.play('apple') + +console.log(newPlayer.plays) diff --git a/spec/scrabble_spec.js b/spec/scrabble_spec.js index c195a03..0223459 100644 --- a/spec/scrabble_spec.js +++ b/spec/scrabble_spec.js @@ -41,7 +41,7 @@ describe('highestScoreFrom', function() { expect(Scrabble.highestScoreFrom).toBeDefined(); }); - it ('throws if no words were passed', function() { + xit ('throws if no words were passed', function() { expect(function() { Scrabble.highestScoreFrom([]); }).toThrow(); expect(function() { Scrabble.highestScoreFrom('not array'); }).toThrow(); }); @@ -60,7 +60,7 @@ describe('highestScoreFrom', function() { expect(Scrabble.highestScoreFrom(['pig', 'dog'])).toBe('pig'); }); - it ('if tied, prefer a word with 7 letters', function() { + xit ('if tied, prefer a word with 7 letters', function() { const loser = 'zzzzzz'; const winner = 'iiiiddd'; @@ -73,7 +73,7 @@ describe('highestScoreFrom', function() { expect(Scrabble.highestScoreFrom([winner, loser])).toBe(winner); }); - it ('if tied and no word has 7 letters, prefers the word with fewer letters', function() { + xit ('if tied and no word has 7 letters, prefers the word with fewer letters', function() { // Check score assumptions expect(Scrabble.score('dog')).toBe(5); expect(Scrabble.score('goat')).toBe(5); @@ -137,7 +137,7 @@ describe('Player', function() { expect(player.plays.length).toBe(0); }); - it ('Returns false and does not update plays if the player has already won', function() { + xit ('Returns false and does not update plays if the player has already won', function() { let player = new Scrabble.Player('test player'); expect(player.play('zzzzzzz')).toBeTruthy(); // +120 pts expect(player.plays.length).toBe(1); @@ -166,7 +166,7 @@ describe('Player', function() { }); }); - describe('hasWon', function() { + xdescribe('hasWon', function() { it('returns false when score < 100', function() { let player = new Scrabble.Player('test player'); expect(player.totalScore()).toBe(0); @@ -206,7 +206,7 @@ describe('Player', function() { expect(player.highestScoringWord()).toBe('zzzz'); }); - it('throws an error if no words have been played', function() { + xit('throws an error if no words have been played', function() { let player = new Scrabble.Player('test player'); expect(() => { player.highestScoringWord() }).toThrow(); }); From 3d84c3db0b165163ca276397bae72bd917512261 Mon Sep 17 00:00:00 2001 From: Kimberley Zell Date: Wed, 15 Nov 2017 11:55:48 -0800 Subject: [PATCH 2/7] fixed some errors with throw for array of one word and for arrays with characters that are not letters A-Z" --- scrabble.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/scrabble.js b/scrabble.js index 982800a..e8dd68a 100644 --- a/scrabble.js +++ b/scrabble.js @@ -10,9 +10,11 @@ const Scrabble = { let score = 0; if (word.length >= 1) { - if ((/^[a-zA-Z]/.test(word)) == false) { + if ((/^[a-zA-Z]+$/.test(word)) == false) { throw('Word must contain only letters A-Z'); } + } else { + throw('Cannot score - no word entered'); } let letters = word.toUpperCase().split(''); @@ -26,11 +28,11 @@ const Scrabble = { } letters.forEach(function(letter) { - if (/^[a-zA-Z]/.test) { + // if (/^[a-zA-Z]+$/.test) { score += scoringHash[letter]; - } else { - throw('Word must contain only letters A-Z') - } + // } else { + // throw('Word must contain only letters A-Z') + // } }) @@ -116,3 +118,12 @@ newPlayer = new Scrabble.Player('Jeff') newPlayer.play('apple') console.log(newPlayer.plays) + +let emptyArray = ['']; +let oneArray = ['doggie']; + +let emptyArrayScore + +console.log(`HighestScoreFrom Empty array: ${Scrabble.highestScoreFrom(emptyArray)}`); +console.log(`HighestScoreFrom Empty array: ${Scrabble.highestScoreFrom(emptyArray).length}`); +console.log(`HighestScoreFrom One array: ${Scrabble.highestScoreFrom(oneArray)}`); From 296a503b949ec6efbb85fa20764f71b75c88ccff Mon Sep 17 00:00:00 2001 From: Kimberley Zell Date: Wed, 15 Nov 2017 13:40:30 -0800 Subject: [PATCH 3/7] updated highestScoreFrom to account for two words with same score where one has 7 letters and other does not --- scrabble.js | 37 +++++++++++++++++++++++++++++-------- spec/scrabble_spec.js | 4 ++-- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/scrabble.js b/scrabble.js index e8dd68a..837dcf3 100644 --- a/scrabble.js +++ b/scrabble.js @@ -9,12 +9,14 @@ const Scrabble = { let score = 0; + // if (word.length < 1) { + // throw('Cannot score - no word entered'); + // } + if (word.length >= 1) { if ((/^[a-zA-Z]+$/.test(word)) == false) { throw('Word must contain only letters A-Z'); } - } else { - throw('Cannot score - no word entered'); } let letters = word.toUpperCase().split(''); @@ -35,7 +37,9 @@ const Scrabble = { // } }) - + // if (score === 0) { + // throw('Cannot score - no word entered'); + // } return score; }, @@ -44,12 +48,25 @@ const Scrabble = { if (arrayOfWords.length < 1) { throw('No words have been played yet'); } else { - arrayOfWords.forEach(function(word) { - if (Scrabble.score(highestScoreWord) === 0 || Scrabble.score(word) > Scrabble.score(highestScoreWord)) { - highestScoreWord = word; + arrayOfWords.forEach(function(word) { + if (highestScoreWord === '' || Scrabble.score(word) > Scrabble.score(highestScoreWord)) { + highestScoreWord = word; + } + else if (Scrabble.score(word) === Scrabble.score(highestScoreWord)) { + if (word.length === 7 && word.length > highestScoreWord.length) { + highestScoreWord = word; + } + } } - }); - } + )} + // This works but missing if a word is 7 letters long which one to choose + // arrayOfWords.forEach(function(word) { + // if (highestScoreWord === '' || Scrabble.score(word) > Scrabble.score(highestScoreWord)) { + // if highestScoreWord === + // highestScoreWord = word; + // } + // }); + // } return highestScoreWord; } }; @@ -124,6 +141,10 @@ let oneArray = ['doggie']; let emptyArrayScore +let emptyWord = '' + console.log(`HighestScoreFrom Empty array: ${Scrabble.highestScoreFrom(emptyArray)}`); console.log(`HighestScoreFrom Empty array: ${Scrabble.highestScoreFrom(emptyArray).length}`); console.log(`HighestScoreFrom One array: ${Scrabble.highestScoreFrom(oneArray)}`); + +console.log(`Empty Word Score: ${Scrabble.score(emptyWord)}`) diff --git a/spec/scrabble_spec.js b/spec/scrabble_spec.js index 0223459..fb9c92b 100644 --- a/spec/scrabble_spec.js +++ b/spec/scrabble_spec.js @@ -41,7 +41,7 @@ describe('highestScoreFrom', function() { expect(Scrabble.highestScoreFrom).toBeDefined(); }); - xit ('throws if no words were passed', function() { + it ('throws if no words were passed', function() { expect(function() { Scrabble.highestScoreFrom([]); }).toThrow(); expect(function() { Scrabble.highestScoreFrom('not array'); }).toThrow(); }); @@ -60,7 +60,7 @@ describe('highestScoreFrom', function() { expect(Scrabble.highestScoreFrom(['pig', 'dog'])).toBe('pig'); }); - xit ('if tied, prefer a word with 7 letters', function() { + it ('if tied, prefer a word with 7 letters', function() { const loser = 'zzzzzz'; const winner = 'iiiiddd'; From 235d62a6bb6b9ab5ed48939e4922cfa48cdbe739 Mon Sep 17 00:00:00 2001 From: Kimberley Zell Date: Wed, 15 Nov 2017 13:43:33 -0800 Subject: [PATCH 4/7] updated highestScoreFrom to score words less than 7 letters to give the tie to the word with the least letters --- scrabble.js | 2 ++ spec/scrabble_spec.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/scrabble.js b/scrabble.js index 837dcf3..e9cc396 100644 --- a/scrabble.js +++ b/scrabble.js @@ -55,6 +55,8 @@ const Scrabble = { else if (Scrabble.score(word) === Scrabble.score(highestScoreWord)) { if (word.length === 7 && word.length > highestScoreWord.length) { highestScoreWord = word; + } else if (highestScoreWord.length < 7 && word.length < highestScoreWord.length) { + highestScoreWord = word; } } } diff --git a/spec/scrabble_spec.js b/spec/scrabble_spec.js index fb9c92b..1b5894e 100644 --- a/spec/scrabble_spec.js +++ b/spec/scrabble_spec.js @@ -73,7 +73,7 @@ describe('highestScoreFrom', function() { expect(Scrabble.highestScoreFrom([winner, loser])).toBe(winner); }); - xit ('if tied and no word has 7 letters, prefers the word with fewer letters', function() { + it ('if tied and no word has 7 letters, prefers the word with fewer letters', function() { // Check score assumptions expect(Scrabble.score('dog')).toBe(5); expect(Scrabble.score('goat')).toBe(5); From 11656a79844ae23c191eb3b55688ad72feb33b1c Mon Sep 17 00:00:00 2001 From: Kimberley Zell Date: Wed, 15 Nov 2017 14:07:53 -0800 Subject: [PATCH 5/7] all tests now passing - turns out my test code I had written at the bottom was causing an error to throw and tests would not run --- scrabble.js | 65 +++++++++++++++++++++---------------------- spec/scrabble_spec.js | 6 ++-- 2 files changed, 34 insertions(+), 37 deletions(-) diff --git a/scrabble.js b/scrabble.js index e9cc396..cedf4d3 100644 --- a/scrabble.js +++ b/scrabble.js @@ -9,9 +9,9 @@ const Scrabble = { let score = 0; - // if (word.length < 1) { - // throw('Cannot score - no word entered'); - // } + if (word.length < 1) { + throw new Error ('Cannot score - no word entered'); + } if (word.length >= 1) { if ((/^[a-zA-Z]+$/.test(word)) == false) { @@ -61,14 +61,7 @@ const Scrabble = { } } )} - // This works but missing if a word is 7 letters long which one to choose - // arrayOfWords.forEach(function(word) { - // if (highestScoreWord === '' || Scrabble.score(word) > Scrabble.score(highestScoreWord)) { - // if highestScoreWord === - // highestScoreWord = word; - // } - // }); - // } + return highestScoreWord; } }; @@ -85,8 +78,8 @@ Scrabble.Player = class { } play(word) { - if (this.hasWon()) { - return false + if (this.hasWon() === true) { + return false; } else { let wordScore = Scrabble.score(word); // this.totalScore += wordScore; @@ -104,7 +97,7 @@ Scrabble.Player = class { } hasWon() { - if (this.totalScore >= 100) { + if (this.totalScore() >= 100) { return true; } else { return false; @@ -130,23 +123,27 @@ Scrabble.Player = class { module.exports = Scrabble; -console.log(Scrabble.score('cat')); - -newPlayer = new Scrabble.Player('Jeff') - -newPlayer.play('apple') - -console.log(newPlayer.plays) - -let emptyArray = ['']; -let oneArray = ['doggie']; - -let emptyArrayScore - -let emptyWord = '' - -console.log(`HighestScoreFrom Empty array: ${Scrabble.highestScoreFrom(emptyArray)}`); -console.log(`HighestScoreFrom Empty array: ${Scrabble.highestScoreFrom(emptyArray).length}`); -console.log(`HighestScoreFrom One array: ${Scrabble.highestScoreFrom(oneArray)}`); - -console.log(`Empty Word Score: ${Scrabble.score(emptyWord)}`) +// console.log(Scrabble.score('cat')); +// +// newPlayer = new Scrabble.Player('Jeff') +// +// newPlayer.play('zzzzzzz') +// +// console.log(newPlayer.plays) +// +// let emptyArray = ['']; +// let oneArray = ['doggie']; +// +// let emptyArrayScore +// +// let emptyWord = '' +// +// console.log(`HighestScoreFrom Empty array: ${Scrabble.highestScoreFrom(emptyArray)}`); +// console.log(`HighestScoreFrom Empty array: ${Scrabble.highestScoreFrom(emptyArray).length}`); +// console.log(`HighestScoreFrom One array: ${Scrabble.highestScoreFrom(oneArray)}`); +// +// // console.log(`Empty Word Score: ${Scrabble.score(emptyWord)}`); +// +// console.log(`Player with one word total score: ${newPlayer.totalScore()}`); +// +// console.log(newPlayer.hasWon()); diff --git a/spec/scrabble_spec.js b/spec/scrabble_spec.js index 1b5894e..c195a03 100644 --- a/spec/scrabble_spec.js +++ b/spec/scrabble_spec.js @@ -137,7 +137,7 @@ describe('Player', function() { expect(player.plays.length).toBe(0); }); - xit ('Returns false and does not update plays if the player has already won', function() { + it ('Returns false and does not update plays if the player has already won', function() { let player = new Scrabble.Player('test player'); expect(player.play('zzzzzzz')).toBeTruthy(); // +120 pts expect(player.plays.length).toBe(1); @@ -166,7 +166,7 @@ describe('Player', function() { }); }); - xdescribe('hasWon', function() { + describe('hasWon', function() { it('returns false when score < 100', function() { let player = new Scrabble.Player('test player'); expect(player.totalScore()).toBe(0); @@ -206,7 +206,7 @@ describe('Player', function() { expect(player.highestScoringWord()).toBe('zzzz'); }); - xit('throws an error if no words have been played', function() { + it('throws an error if no words have been played', function() { let player = new Scrabble.Player('test player'); expect(() => { player.highestScoringWord() }).toThrow(); }); From 25e3eadaf6794eaaef5f5cf2f5955f7b667afc02 Mon Sep 17 00:00:00 2001 From: Kimberley Zell Date: Wed, 15 Nov 2017 14:09:58 -0800 Subject: [PATCH 6/7] cleaned up code not using --- scrabble.js | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/scrabble.js b/scrabble.js index cedf4d3..4c30607 100644 --- a/scrabble.js +++ b/scrabble.js @@ -25,21 +25,12 @@ const Scrabble = { score += 50 } else if (letters.length > 7) { throw('Maximum 7 letters are allowed!'); - // } else if (letters.length < 1) { - // throw('No word entered'); } letters.forEach(function(letter) { - // if (/^[a-zA-Z]+$/.test) { score += scoringHash[letter]; - // } else { - // throw('Word must contain only letters A-Z') - // } }) - // if (score === 0) { - // throw('Cannot score - no word entered'); - // } return score; }, @@ -70,7 +61,6 @@ Scrabble.Player = class { constructor(name) { this.name = name; this.plays = []; - // this.totalScore = 0; if (name === undefined) { throw('Player must have a name'); @@ -82,7 +72,6 @@ Scrabble.Player = class { return false; } else { let wordScore = Scrabble.score(word); - // this.totalScore += wordScore; this.plays.push(word); return true; } @@ -121,29 +110,3 @@ Scrabble.Player = class { }; module.exports = Scrabble; - - -// console.log(Scrabble.score('cat')); -// -// newPlayer = new Scrabble.Player('Jeff') -// -// newPlayer.play('zzzzzzz') -// -// console.log(newPlayer.plays) -// -// let emptyArray = ['']; -// let oneArray = ['doggie']; -// -// let emptyArrayScore -// -// let emptyWord = '' -// -// console.log(`HighestScoreFrom Empty array: ${Scrabble.highestScoreFrom(emptyArray)}`); -// console.log(`HighestScoreFrom Empty array: ${Scrabble.highestScoreFrom(emptyArray).length}`); -// console.log(`HighestScoreFrom One array: ${Scrabble.highestScoreFrom(oneArray)}`); -// -// // console.log(`Empty Word Score: ${Scrabble.score(emptyWord)}`); -// -// console.log(`Player with one word total score: ${newPlayer.totalScore()}`); -// -// console.log(newPlayer.hasWon()); From 6b450f25a46932f091dbf3d4d38577391b2cfdda Mon Sep 17 00:00:00 2001 From: Kimberley Zell Date: Thu, 16 Nov 2017 22:40:43 -0800 Subject: [PATCH 7/7] making sure all code has been pushed to github --- scrabble.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scrabble.js b/scrabble.js index 4c30607..0de8f28 100644 --- a/scrabble.js +++ b/scrabble.js @@ -100,9 +100,9 @@ Scrabble.Player = class { if (allPlays === undefined) { return total; } else { - allPlays.forEach(function(word) { - total += Scrabble.score(word); - }); + allPlays.forEach(function(word) { + total += Scrabble.score(word); + }); } return total }