1
0
This question was inspired by Tom Scott's video here.
The English language has plenty of words, but what's the longest one that can be displayed on a seven segment display? Your challenge is given a list of letters that may not be displayed, display the longest English word in a 7 segment display format?
Input
- Input will contain a series of unacceptable characters. (letters that you are not permitted to use in your word.)
- Input can be taken from one of the following:
stdin
- command-line arguments
- function arguments
Output
- Output the longest word using the provided alphabet from the input. (In the case of 2 words of the same length, the one that comes first is the "longest". When a hyphen is in the word, it counts towards its length, but is not displayed.)
- Output must be formatted like a 7 segment display, see the rules below for more about the format.
- Output must be in stdout or closest equivalent.
- Output may contain a trailing newline character.
Letters
This image shows my source of the alphabet
Here is my simple ascii display so you can visually see the letters (my apologies, the wrap function I used broke with spaces so I had to settle on asterisks). And here is a table to show the alphabet as well:
____ A
| F | B
| |
____ G
| |
| E | C
____ D
ABCDEFG Letter
1110111 a
0011111 b
1001110 c
0111101 d
1001111 e
1000111 f
1011110 g
0010111 h
0000110 i
0111100 j
1010111 k
0001110 l
1010100 m
1110110 n
1111110 o
1100111 p
1110011 q
1100110 r
1011011 s
0001111 t
0111110 u
0111010 v
0101010 w
0110111 x
0111011 y
1101001 z
Rules
- Standard loopholes are disallowed HOWEVER words.txt (the dictionary) is the only outside file you may reference (renaming it is not allowed, it must be called
words.txt
as it is in the repository). - The seven segment display must:
- Be an actual seven segment display. (I'm not going to be picky on how it looks, if it was accepted over there then it's accepted over here.)
- Have any filler/whitespace character of choice.
Test Cases
Wrapping is an unnecessary challenge and is not needed; I did it out of ease of looking at it in my terminal. Remember: Your whitespace does not need the same character.
input:
gkmqvwxz
output:
******************____********************____****____****____********
******|**|*******|*******|*******|*******|****|**|****|**|****|*******
******|**|*******|*******|*******|*******|****|**|****|**|****|*******
**____********************____************************************____
*|****|**|*******|*******|****|**|*******|****|**|*******|****|**|****
*|****|**|*******|*******|****|**|*******|****|**|*******|****|**|****
**____************____************____****____************____****____
************____************____****____****************************__
|**|*******|****|**|*******|*******|****|**|****|**|*******|*******|**
|**|*******|****|**|*******|*******|****|**|****|**|*******|*******|**
************____****____****____************____************____******
|**|*******|*******|****|**|*******|****|*******|**|*******|*******|**
|**|*******|*******|****|**|*******|****|*******|**|*******|*******|**
****************************____************____****____****____******
__************____********************____****____****____****____****
**|**|*******|*******|*******|*******|****|**|****|**|****|**|*******|
**|**|*******|*******|*******|*******|****|**|****|**|****|**|*******|
**********************____************************************____****
*****|*******|*******|****|**|*******|****|**|*******|****|**|*******|
*****|*******|*******|****|**|*******|****|**|*******|****|**|*******|
**************____************____****____************____****____****
****************____****____****____**
*******|*******|****|**|****|**|******
*******|*******|****|**|****|**|******
____****____****____************____**
*******|****|**|****|**|****|**|******
*******|****|**|****|**|****|**|******
____****************************____**
The word should be "dichlorodiphenyltrichloroethane" for debugging purposes.
input:
gkmqvwxzio
output:
**____************____****____****____************____****____****____
*|*******|****|**|****|**|*******|****|**|*******|****|**|****|**|****
*|*******|****|**|****|**|*******|****|**|*******|****|**|****|**|****
**____************____****____************____************____********
******|**|****|**|*******|*******|*******|*******|*******|****|**|****
******|**|****|**|*******|*******|*******|*******|*******|****|**|****
**____****____************____************____************************
****____****____****____****____************____****____************__
|**|*******|*******|*******|****|*******|**|*******|****|**|*******|**
|**|*******|*******|*******|****|*******|**|*******|****|**|*******|**
****____************____************____****____************____******
|*******|**|*******|*******|****|**|****|**|*******|****|**|*******|**
|*******|**|*******|*******|****|**|****|**|*******|****|**|*******|**
****____****____****____************____****____************____******
__****____****____****____**
**|**|*******|*******|******
**|**|*******|*******|******
******____****____****____**
**|**|************|*******|*
**|**|************|*******|*
******____****____****____**
The word should be "supertranscendentness" for debugging purposes.
input:
abcdefghijklm
output:
**********____****____************____********************____****____
*|*******|****|**|****|**|*******|*******|****|**|****|**|****|**|****
*|*******|****|**|****|**|*******|*******|****|**|****|**|****|**|****
**____********************____****____****____************************
*|*******|****|**|****|**|************|*******|**********|****|**|****
*|*******|****|**|****|**|************|*******|**********|****|**|****
**____****____****____****____****____****____****____****____****____
************____**********
|**|*******|*******|****|*
|**|*******|*******|****|*
****____****____****____**
|**|************|*******|*
|**|************|*******|*
****____****____****____**
The word should be "tootsy-wootsy" for debugging purposes. (We do not output the hyphen but it does count towards the length of the word.)
input:
ikmopqsvwz
output:
**____****____****____****____************____****____****____****____
*|*******|****|**|*******|****|**|*******|*******|****|**|****|**|****
*|*******|****|**|*******|****|**|*******|*******|****|**|****|**|****
******************____****____****____********************____********
*|****|**|*******|*******|****|**|*******|****|**|*******|****|**|****
*|****|**|*******|*******|****|**|*******|****|**|*******|****|**|****
**____************____************____****____************************
********************____************____********************____****__
|*******|*******|**|****|**|****|**|*******|*******|*******|*******|**
|*******|*******|**|****|**|****|**|*******|*******|*******|*******|**
****____****____****____********************____****____****____******
|**|****|**|****|**|****|**|****|**|****|**|****|**|*******|*******|**
|**|****|**|****|**|****|**|****|**|****|**|****|**|*******|*******|**
****____****____************____****____************____****____******
__**
**|*
**|*
****
****
****
****
The word should be "great-granddaughter" for debugging purposes. (We do not output the hyphen but it does count towards the length of the word.)
Scoring
This is code-golf, so the shortest submission (in bytes) wins.
(This is also my first question so tell me if I skipped over something or something is unclear or not. Thanks and good luck!)
6As with a lot of challenges involving finding a specific english word, I reccomend the dictionary of words be passed to the program as a list rather thsn be stored somewhere else. This makes it much easier to test – Jo King – 2018-10-11T10:50:13.257
@JoKing So what you mean is it is passed in as a separate argument or input? (If you linked an example that may be helpful for me to get what you are saying.) – Josh B. – 2018-10-11T19:08:11.067
For example, Generate a Portmentout
– Jo King – 2018-10-11T21:00:09.4236This seems like it would be more appropriate as 2 distinct challenges: (1) given some dictionary, find the longest word not using characters from some set; (2) convert a string of characters in
a..z
into 7-segment form according to your spec. – Chas Brown – 2018-10-12T00:59:37.707As regards the part of the challenge where you seek the longest string in some dictionary which does not contain certain characters: you more generally say to ignore hyphens; so is
're-sort'
longer than'resort'
, or are they the same length? – Chas Brown – 2018-10-12T02:32:14.900@ChasBrown It should have been more clearly stated, what I meant was you are to ignore the hyphens when it is output but
're-sort'
is longer than `'resort'``. I will change the phrasing of the question to help remove that confusion. – Josh B. – 2018-10-12T19:04:54.150Need clarification on non-letters: should they A) be skipped in output or B) be assumed blank or C) can we choose? – Titus – 2018-10-17T11:38:51.163
2test case with "abcdefghijklm" input states than correct word is "tootsy-wootsy". But "Rostov-on-Don" has the same length and comes first. may you to justify that result? – J. Sendra – 2019-03-01T21:36:11.813