You're stuck in a cabin in the middle of the woods, with only an old scrabble set to entertain yourselves. Upon inspection you see that the scrabble letters are so worn, that only the points for each letter are visible.
Nonetheless you decide to play a game. You pull seven letters from the bag and place them on your tray, your challenge is to determine what those letters could be.
So generally, given a list of points convert it into any possible string or list of letters.
Scrabble Tiles and Distributions
- 2 blank tiles (scoring 0 points)
- 1 point: E ×12, A ×9, I ×9, O ×8, N ×6, R ×6, T ×6, L ×4, S ×4, U ×4
- 2 points: D ×4, G ×3
- 3 points: B ×2, C ×2, M ×2, P ×2
- 4 points: F ×2, H ×2, V ×2, W ×2, Y ×2
- 5 points: K ×1
- 8 points: J ×1, X ×1
- 10 points: Q ×1, Z ×1
So if you have a list of points
"QZJKEEE" would be valid but
"QQJKEEE" would not be valid (since there is only 1 Q tile in the bag)
Problem Specific Rules
- You may assume all inputs are valid and that there will always be 7 tiles (i.e it wont be a list of seven 10 point tiles and won't be 9 tiles)
- You can assume no tiles have been previously pulled from the bag (so the distribution is the standard distribution of english tiles as defined above)
- You do not have to generate a valid word, only a valid string of letters.
- The order of your string is irrelevant as long as for each tile there is a corresponding letter.
- Points are based on the standard english scrabble tile points as defined above.
- You may output in upper or lower case, for a blank tile you may output either a space character or an underscore '_'
- Your answer may output as any reasonable representation of the tiles such as a List, String, Array or Sequence
- This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
- Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
- Default Loopholes are forbidden.
- If possible, please add a link with a test for your code (i.e. TIO).
- Also, adding an explanation for your answer is highly recommended.
Obviously since you can output any possible value it's difficult to define strict test cases.
Some cases with a possible valid return value:
[10,0,10,5,8,8,0] -> "Q ZKJX " [1,1,1,1,1,1,1] -> "EEEEEEE" [1,2,3,4,5,8,0] -> "NDBHKJ " [2,2,2,2,2,2,2] -> "DGDGDGD"
Some cases with an invalid return value:
[10,0,10,5,8,8,0] -> "Q QKJX " - Too many Qs [1,1,1,1,1,1,1] -> "EEEEEE " - Space is 0 points not 1 [1,2,3,4,5,8,0] -> "NDBH" - Too short [1,2,3,4,5,8,0] -> "NDBHKJ I" - Too long [1,2,3,4,5,8,0] -> "ÉDBHKJ1" - Contains none scrabble characters [2,2,2,2,2,2,2] -> "GDGDGDG" - Contains too many Gs (case for invalid cycling)