Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add commonised JSON to scrabble score problem #161

Closed
wants to merge 2 commits into from
Closed

Add commonised JSON to scrabble score problem #161

wants to merge 2 commits into from

Conversation

SwamWithTurtles
Copy link

No description provided.

"msg": "No, 'a' scores 1 point"
},
{
"description": "Uppercase Short input",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Short/short I think.

@kytrinyx
Copy link
Member

I have a few small comments, but nothing major. Thanks!

@kytrinyx
Copy link
Member

kytrinyx commented Apr 7, 2016

@SwamWithTurtles Any chance you'll have time to make the changes on this one? I'd love to merge it.

IanWhitney pushed a commit to IanWhitney/xrust that referenced this pull request May 17, 2016
Implements the Scrabble Score exercise.

As of right now there is no official test suite for Scrabble Score.
There is a PR (exercism/problem-specifications#161), but it
is not yet merged.

I've put this exercise between the Nucleotides and Roman Numerals,
figuring that it did similar character iteration and value mapping.

I am following the test suite in that PR, with one exception. I thought
it was likely that a common naive implementation would be to map through
the chars, find the score and then simply unwrap the value. Like this

```
word.chars().map(|c| values.get(&c).fold(0, |sum, v| sum + v.unwrap())
```

So I have added a test that uses a non-English character that will cause this
implementation to panic.

My example implementation probably leaves a lot to be desired. I wanted
to make the values hash a static, but you can't do that with a hash.
([Lazy
Static](http://rust-lang-nursery.github.io/lazy-static.rs/lazy_static/index.html)
does let you do this, but I'm not going to require a crate in my
example).
@IanWhitney
Copy link
Contributor

I'm working on implementing this in Rust, and I've followed this proposed PR. But I added one test for the edge case of Non-English characters:

https://github.com/exercism/xrust/pull/125/files#diff-26a63b91a0b305a1fd995e76a5ef5ad2R54

Though this is particularly useful in Rust (or other languages with Optional types), I can it being a useful test in other languages as well.

@kytrinyx
Copy link
Member

Superseded by #255 - thanks for your work on this one @SwamWithTurtles!

@kytrinyx kytrinyx closed this May 19, 2016
IanWhitney pushed a commit to IanWhitney/xrust that referenced this pull request May 25, 2016
Implements the Scrabble Score exercise.

As of right now there is no official test suite for Scrabble Score.
There is a PR (exercism/problem-specifications#161), but it
is not yet merged.

I've put this exercise between the Nucleotides and Roman Numerals,
figuring that it did similar character iteration and value mapping.

I am following the test suite in that PR, with one exception. I thought
it was likely that a common naive implementation would be to map through
the chars, find the score and then simply unwrap the value. Like this

```
word.chars().map(|c| values.get(&c).fold(0, |sum, v| sum + v.unwrap())
```

So I have added a test that uses a non-English character that will cause this
implementation to panic.

My example implementation probably leaves a lot to be desired. I wanted
to make the values hash a static, but you can't do that with a hash.
([Lazy
Static](http://rust-lang-nursery.github.io/lazy-static.rs/lazy_static/index.html)
does let you do this, but I'm not going to require a crate in my
example).
emcoding pushed a commit that referenced this pull request Nov 19, 2018
Pre-Push and local check setup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants