Skip to content

digital-futures-academy/pre-academy-scrabble-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scrabble Challenge

Welcome to the Scrabble challenge!

Learning Objectives

  • Build a simple program using functions, loops, and flow control
  • Use git & GitHub to commit work and open a Pull Request

Instructions

  1. Fork this repository and then:
$ git clone https://github.com/<YOUR GITHUB USERNAME>/pre-academy-scrabble-challenge.git && cd pre-academy-scrabble-challenge
$ npm install # installs dependencies listed in package.json
  1. Run the tests from your project root directory. There should be a lot of failures to begin with. You can run your test suite in a few ways:
$ npm test
# or
$ jasmine
# or run jasmine directly
$ ./node_modules/jasmine/bin/jasmine.js
  1. In GitHub, open a Pull Request from your forked repository to the challenge repository.
  2. Implement the criteria below locally and push your code to your repository! Every push to a branch that has an open Pull Request will update it automatically with your changes.
  3. Check the status of the automated tests on the Pull Request - if successful you should see something like this:

Pull Request Status

  • You should see that the 4 checks have passed - essentially these run the tests that we have provided for the Standard Criteria
    • if these do not pass, your solution is not correct and you need to revisit your code
    • you will not need to make another pull request, simply add and commit further changes to your code and recheck the status again
  • You are not allowed to merge your changes into the digital-futures-academy/pre-academy-scrabble-challenge repository at this point
  • Merging is blocked - you cannot merge your changes but rest assured, the team can see your pull request from our end!

Task

Given a word, compute the scrabble score for that word.

Letter Values

You'll need these:

Letter Value
A, E, I, O, U, L, N, R, S, T 1
D, G 2
B, C, M, P 3
F, H, V, W, Y 4
K 5
J, X 8
Q, Z 10

Example "cabbage" should be scored as worth 14 points:

  • 3 points for C
  • 1 point for A, twice
  • 3 points for B, twice
  • 2 points for G
  • 1 point for E

And to total:

3 + 2x1 + 2x3 + 2 + 1
= 3 + 2 + 6 + 3
= 14

Acceptance Criteria

let scrabble = new Scrabble('')
scrabble.score() // => 0

let scrabble = new Scrabble(" \t\n")
scrabble.score() // => 0

let scrabble = new Scrabble(null)
scrabble.score() // => 0

let scrabble = new Scrabble('a')
scrabble.score() // => 1

let scrabble = new Scrabble('f')
scrabble.score() // => 4

let scrabble = new Scrabble('street')
scrabble.score() // => 6

let scrabble = new Scrabble('quirky')
scrabble.score() // => 22

let scrabble = new Scrabble('OXYPHENBUTAZONE')
scrabble.score() // => 41

Extended Acceptance Criteria - just for fun - no tests exist for these

Each Scrabble method should be no more than 5 lines and contain no more than 5 operations.

You can play a double or a triple letter.

You can play a double or a triple word.

Can you write tests for these, based on the the test structure above?

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published