Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions pseudocode.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,31 @@
#### Add the steps you need to take to implement the requirements for Scrabble Challenge

```
1.
- Steps for the core scrabble functionality

1. Get the given word

2. Check if it's a valid word

3. Create arrays of letters groupped according to the points they give

4. Create a variable to sum the points of each character according to the letter

5. Itterate through the word and check each character against the 'points' arrays. Add the value of each letter to the sum of points

6. Return the sum of the points

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

- Steps for the double/triple-points letters functionality

1. Decide how to implement this functionality.

1. Check if the given word contains characters enclosed in {} or []

2. Apply points * 2 for letters in {} and points * 3 for letters in []


2.

3.

...etc
```
8 changes: 4 additions & 4 deletions spec/extensions/scrabble.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

const scrabble = require('../../src/scrabble')

describe("Scrabble", () => {
describe("letter multipliers", () => {
describe('Scrabble', () => {
describe('letter multipliers', () => {
it('returns 6 for double letter o', () => {
expect(scrabble('d{o}g')).toEqual(6)
})
Expand All @@ -21,7 +21,7 @@ describe("Scrabble", () => {
})
})

describe("word multipliers", () => {
describe('word multipliers', () => {
it('returns 10 for double letter o', () => {
expect(scrabble('{dog}')).toEqual(10)
})
Expand All @@ -38,7 +38,7 @@ describe("Scrabble", () => {
})
})

describe("edge cases", () => {
describe('edge cases', () => {
it('returns 18 for letter and word multiplier', () => {
expect(scrabble('{[d]og}')).toEqual(18)
})
Expand Down
2 changes: 1 addition & 1 deletion spec/scrabble.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const scrabble = require('../src/scrabble')

describe("Scrabble", () => {
describe('Scrabble', () => {
it('returns 0 for empty words', () => {
expect(scrabble('')).toEqual(0)
})
Expand Down
Loading