-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement scrabble-score in Javascript
- Loading branch information
1 parent
79848ac
commit 6c4524e
Showing
11 changed files
with
9,217 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"root": true, | ||
"extends": "@exercism/eslint-config-javascript", | ||
"env": { | ||
"jest": true | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": [".meta/proof.ci.js", ".meta/exemplar.js", "*.spec.js"], | ||
"excludedFiles": ["custom.spec.js"], | ||
"extends": "@exercism/eslint-config-javascript/maintainers" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/node_modules | ||
/bin/configlet | ||
/bin/configlet.exe | ||
/pnpm-lock.yaml | ||
/yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
audit=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Help | ||
|
||
## Running the tests | ||
|
||
## Setup | ||
|
||
Go through the setup [instructions for JavaScript][docs-exercism-javascript] to install the necessary dependencies. | ||
|
||
## Requirements | ||
|
||
Install assignment dependencies: | ||
|
||
```shell | ||
# Using npm | ||
npm install | ||
|
||
# Alternatively using yarn | ||
yarn | ||
``` | ||
|
||
## Making the test suite pass | ||
|
||
All exercises come with a test suite to help you validate your solution before submitting. | ||
You can execute these tests by opening a command prompt in the exercise's directory, and then running: | ||
|
||
```bash | ||
# Using npm | ||
npm test | ||
|
||
# Alternatively using yarn | ||
yarn test | ||
``` | ||
|
||
In some test suites all tests but the first have been skipped. | ||
|
||
Once you get a test passing, you can enable the next one by changing `xtest` to `test`. | ||
|
||
## Writing custom tests | ||
|
||
If you wish to write additional, custom, tests, create a new file `custom.spec.js`, and submit it with your solution together with the new file: | ||
|
||
```shell | ||
exercism submit numbers.js custom.spec.js | ||
``` | ||
|
||
[docs-exercism-javascript]: https://exercism.org/docs/tracks/javascript/installation | ||
|
||
## Submitting your solution | ||
|
||
You can submit your solution using the `exercism submit scrabble-score.js` command. | ||
This command will upload your solution to the Exercism website and print the solution page's URL. | ||
|
||
It's possible to submit an incomplete solution which allows you to: | ||
|
||
- See how others have completed the exercise | ||
- Request help from a mentor | ||
|
||
## Need to get help? | ||
|
||
If you'd like help solving the exercise, check the following pages: | ||
|
||
- The [JavaScript track's documentation](https://exercism.org/docs/tracks/javascript) | ||
- The [JavaScript track's programming category on the forum](https://forum.exercism.org/c/programming/javascript) | ||
- [Exercism's programming category on the forum](https://forum.exercism.org/c/programming/5) | ||
- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs) | ||
|
||
Should those resources not suffice, you could submit your (incomplete) solution to request mentoring. | ||
|
||
To get help if you're having trouble, you can use one of the following resources: | ||
|
||
- [/r/javascript](https://www.reddit.com/r/javascript) is the Javascript subreddit. | ||
- [StackOverflow](https://stackoverflow.com/questions/tagged/javascript+exercism) can be used to search for your problem and see if it has been answered already. You can also ask and answer questions. | ||
- [Github issue tracker](https://github.com/exercism/javascript/issues) is where we track our development and maintainance of Javascript exercises in exercism. But if none of the above links help you, feel free to post an issue here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Exercism | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Scrabble Score | ||
|
||
Welcome to Scrabble Score on Exercism's JavaScript Track. | ||
If you need help running the tests or submitting your code, check out `HELP.md`. | ||
|
||
## Instructions | ||
|
||
Given a word, compute the Scrabble score for that word. | ||
|
||
## Letter Values | ||
|
||
You'll need these: | ||
|
||
```text | ||
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 | ||
``` | ||
|
||
## Examples | ||
|
||
"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 + 2*1 + 2*3 + 2 + 1` | ||
- = `3 + 2 + 6 + 3` | ||
- = `5 + 9` | ||
- = 14 | ||
|
||
## Extensions | ||
|
||
- You can play a double or a triple letter. | ||
- You can play a double or a triple word. | ||
|
||
## Source | ||
|
||
### Created by | ||
|
||
- @matthewmorgan | ||
|
||
### Contributed to by | ||
|
||
- @amscotti | ||
- @ankorGH | ||
- @ntshcalleia | ||
- @rchavarria | ||
- @ryanplusplus | ||
- @serixscorpio | ||
- @SleeplessByte | ||
|
||
### Based on | ||
|
||
Inspired by the Extreme Startup game - https://github.com/rchatley/extreme_startup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
presets: ['@exercism/babel-preset-javascript'], | ||
plugins: [], | ||
}; |
Oops, something went wrong.