Count to 20 with Words!

39

4

Using the following length-separated lists of words:

https://github.com/Magic Octopus Urn/wordListsByLength

Print 1 word from each list of length n from 1 all the way up to 20, here's a valid example:

a
an
and
hand
hands
handle
handles
abandons
abandoned
understand
outstanding
newfoundland
understanding
characteristic
characteristics
characterization
characterizations
characteristically
characterologically
chemotherapeutically

Alternatively (array):

['a', 'an', 'and', 'hand', 'hands', 'handle', 'handles', 'abandons', 'abandoned', 'understand', 'outstanding', 'newfoundland', 'understanding', 'characteristic', 'characteristics', 'characterization', 'characterizations', 'characteristically', 'characterologically', 'chemotherapeutically']

Alternatively (any printable non-alphabetic separator other than \n):

a:an:and:hand:hands:handle:handles:abandons:abandoned:understand:outstanding:newfoundland:understanding:characteristic:characteristics:characterization:characterizations:characteristically:characterologically:chemotherapeutically

Rules

  • You may choose your own 20 words.
  • The words must be from the github page provided, more specifically:
    • 1 from 1.txt, 1 from 2.txt, etc...
    • Note, files above 20.txt exist, but you do not need any words above 20 characters.
  • Valid separators are ASCII-printable non-alphabetical characters (even numbers, don't care).
  • Lowercase or uppercase only, pick one, stick with it; no title-case allowed.
  • Please don't use a 100% copy of my example 20 words...
    • You can, but that's no fun.
    • They are likely suboptimal anyways...
  • If you DON'T want to use the separated files, and need a full list:
    • Use unsorted.txt, this is all n.txt files in one, sorted alphabetically.
  • Note, you CANNOT directly read from the URL, it is a common loophole.
  • This is , lowest byte-count will be the winner.

For reference, the output is 229 bytes, so anything that gets under that beats hardcoding.


Possible meta-tag-discussion:

where the user gets to customize their outputs from a list of possibilities?

Magic Octopus Urn

Posted 2017-07-20T15:17:12.367

Reputation: 19 422

Following your links got me here, can I use that list?

– LiefdeWen – 2017-07-20T15:41:15.863

@LiefdeWen that list is equivalent to this list: unsorted.txt so, yes. If you want to have a full-list of words to parse, use unsorted.txt or that.

– Magic Octopus Urn – 2017-07-20T15:44:48.107

4As someone from Newfoundland, I appreciate the shoutout. :) – scatter – 2017-07-20T15:46:48.170

6@Christian You could say I... ( •_•)>⌐■-■ understand outstanding newfoundland (⌐■_■) – Magic Octopus Urn – 2017-07-20T15:48:44.843

As long as you understand the pronunciation - which I'm pretty sure you do, based on that. – scatter – 2017-07-20T15:54:34.530

@StepHen Well, there are compressed strings too, so nah most probably not. – Erik the Outgolfer – 2017-07-20T16:27:59.700

Can we print an array of arrays something like: [["a", "an", "and"],["hand", "hands", "handle", "handles"],...] – Riley – 2017-07-20T16:28:39.447

1@Riley that's stretching it, 1 delimiter inbetween each word, though I can see many situations where that'd help :P. – Magic Octopus Urn – 2017-07-20T16:29:53.057

FYI the three length 1 words do not appear in the unsorted.txt – Jonathan Allan – 2017-07-20T18:48:52.800

Are we allowed to use different (although non-alphabetic) delimiters between our words? For example this, would save me two bytes while maintaining Latin-text-read-order. EDIT - looks like your answer to Riley would imply a "no" I think.

– Jonathan Allan – 2017-07-20T18:50:50.397

1@JonathanAllan just did :). – Magic Octopus Urn – 2017-07-21T00:59:34.800

1Utility for choosing the words. – Jim – 2017-07-21T10:18:23.687

@Jim hehe... I wrote something similar. – Magic Octopus Urn – 2017-07-24T19:46:05.293

Answers

19

Jelly,  49 35 31  30 bytes

ṫ3,⁸Ṗ,$€ẎK
“¤ƈȮⱮ⁴⁷ọḤƁŒ|⁾Ė»ḲÇ€K

A niladic link returning a list of characters, or a full program printing that list as a string (the words delimited by spaces).

Try it online!

How?

ṫ3,⁸Ṗ,$€ẎK - Helper link: list of characters, word    e.g. "abreacts"
ṫ3         - tail word from index 3                          "reacts"
   ⁸       - chain's left argument, word
  ,        - pair                               ["reacts","abreacts"]
      $€   - last two links as a monad for €ach of the two words:
    Ṗ      -   pop (all but last character)      "react" / "abreact"
     ,     -   pair       ["react","reacts"] / ["abreact","abreacts"]
        Ẏ  - tighten          ["react","reacts","abreact","abreacts"]
         K - join with spaces         "react reacts abreact abreacts"

“¤ƈȮⱮ⁴⁷ọḤƁŒ|⁾Ė»ḲÇ€K - Link: no arguments
“¤ƈȮⱮ⁴⁷ọḤƁŒ|⁾Ė»     - a compressed string using dictionary indexes:
                    -   "agar abreacts acknowledges codeterminations deindustrializations"
               Ḳ    - split at spaces
                Ç€  - call the last link (Helper) as a monad for €ach
                  K - join with spaces

...which yields:

a ar aga agar react reacts abreact abreacts knowledge knowledges acknowledge acknowledges determination determinations codetermination codeterminations industrialization industrializations deindustrialization deindustrializations

Previous:

@35:

“¡Ụıƭz Xj]"Ɱ*AJƤʂạ5ƬṚṪð^ƥỤ»ḲṖ,$€K€K

Using 10 words and their length-1 prefixes.

@49

“ḊAḥTz¹ỴH¡ṛYẈDƤNŀt#ñ²ĿĊḤlṪnð⁻U+ɦỴĊypṆQ0⁴ṄẉṂi⁻d¤&»

Simply 20 compressed words.

Jonathan Allan

Posted 2017-07-20T15:17:12.367

Reputation: 67 804

Darn Jelly dictionary! +1 – Erik the Outgolfer – 2017-07-20T17:31:00.153

I didn't know Jelly had a dictionary, to be honest. – Magic Octopus Urn – 2017-07-21T00:20:36.403

330 BYTES!??!!??! I just went to sleep and woke up and it's as low as 30 BYTES?!!??!?!11 O_O_O – Erik the Outgolfer – 2017-07-21T08:17:11.627

30 BYTES!?!?!??! I FORGOT ABOUT THIS CHALLENGE FOR A MONTH AND HE WON WITH 30 BYTES!?!?! – Magic Octopus Urn – 2017-08-17T21:43:33.427

27

Python 2, 145 bytes

print'i am now tiny @ @s##s#ed#act#acts#@#@s#@ed#@ing#arguments#accusation#accusations#advertisings'.replace('#',' counter').replace('@','check')

Try it online!

Prints these words, separated by spaces:

i
am
now
tiny
check
checks
counter
counters
countered
counteract
counteracts
countercheck
counterchecks
counterchecked
counterchecking
counterarguments
counteraccusation
counteraccusations
counteradvertisings

Lynn

Posted 2017-07-20T15:17:12.367

Reputation: 55 648

18"i am now tiny" - I like the self-descriptive code... – trichoplax – 2017-07-20T18:43:16.313

15

PowerShell, 166 163 bytes

'a
an
and'
'','s','le','ler','lers'|%{"hand$_"}
($a="character")
($x=-split"s ed ful ized istic istics ization izations istically ologically"|%{"$a$_"})
"un"+$x[8]

Try it online!

Hand-optimized, no algorithms. The two loops |%{ } tack on the appropriate ending to the appropriate beginning. I'm searching for a way to get them down into one loop.

AdmBorkBork

Posted 2017-07-20T15:17:12.367

Reputation: 41 581

Wow, my example looks even dumber now xD! characterful > newfoundland – Magic Octopus Urn – 2017-07-20T15:42:42.650

10

Python, 169 bytes

z='odahs princesses acclimatizers cyanocobalamines aerothermodynamics underrepresentations'.split()
print([y[:i+1]for x,y in zip(['']+z,z)for i in range(len(x),len(y))])

Prints a list of the words.

Try it online!

Words gained by scanning sequences of matching words, by start or end of the word and starting from length 1 upwards or from length 20 downwords.

Here is the script I used to get it. (the upward-start-matching one)

Uriel

Posted 2017-07-20T15:17:12.367

Reputation: 11 708

171 bytes (it feels like it should be shorter, but it isn't): Try it online!

– Stephen – 2017-07-20T17:19:46.610

8

Python 2,  126 120  112 bytes

-8 bytes thanks to Anders Kaseorg (I thought I'd migrated this from Python 3, but turns out I'd forgotten!)

A port of my Jelly answer works well in Python too...

for w in"agar abreacts acknowledges codeterminations deindustrializations".split():print w[2:-1],w[2:],w[:-1],w,

Try it online!

Prints:

a ar aga agar react reacts abreact abreacts knowledge knowledges acknowledge acknowledges determination determinations codetermination codeterminations industrialization industrializations deindustrialization deindustrializations 

Jonathan Allan

Posted 2017-07-20T15:17:12.367

Reputation: 67 804

Python 2 lets you end with print w[2:-1],w[2:],w[:-1],w, for −8 bytes. – Anders Kaseorg – 2017-07-28T23:03:13.113

Oh, oops I forgot about this or thought I'd done it - I have a TIO page open somewhere with that! – Jonathan Allan – 2017-07-28T23:05:49.383

Thanks for that though! – Jonathan Allan – 2017-07-28T23:09:03.723

6

JavaScript, 159 bytes

_='a1an1and}}swwrwrs~~s~ed~ful~ized{{s~|~|s{ally~ologically1misx|s~1x}1hand|ization{~isticxcharacterw}le';for(i of'wx{|}~')with(_.split(i))_=join(pop());f=f=>_

Try it online!

Thanks @HyperNeutrino for edit. But, I am reverting back to old post (removing "Node.js" flag) because it has nothing to do with Node.js. It perfectly works in browsers too.

user72349

Posted 2017-07-20T15:17:12.367

Reputation:

f=f=>_ threw me off, I was like "won't that override the function" (it would just prevent recursion) – Stephen – 2017-07-20T16:07:21.843

@StepHen. I'm not sure if leaving a plain string is allowed. As I understood, the code should represent a function (or whole program), thats why I added it to the end. Variable _ already contains the string. – None – 2017-07-20T16:09:30.333

You're correct, I was just really confused as to what it did, since you reused the variable name (f as both function name and (ignored) parameter name) – Stephen – 2017-07-20T16:15:32.733

6

05AB1E, 51 bytes

’¯Óa‚‡’D“€…€¤Þ¨íʃé¢Ã¥£žÜ¶ß´ç…àçî×Ü»‡ÛೌçÓs²® ÿ ÿs

Try it online!

Separator:

List of words: a, an, ana, anal, house, houses, amazing, criminal, seriously, apparently, accessories, disciplinary, distributions, discrimination, congratulations, responsibilities, characterizations, telecommunications, representationalist, representationalists

Erik the Outgolfer

Posted 2017-07-20T15:17:12.367

Reputation: 38 134

1*want to participate in own challenge intensifies* – Magic Octopus Urn – 2017-07-21T00:19:41.113

I'm guessing 05AB1E has no 20-length words in the dictionary :P? Have yet to actually check myself. – Magic Octopus Urn – 2017-07-21T00:29:29.707

@MagicOctopusUrn Nope.

– Adnan – 2017-07-21T01:06:51.000

@adnan wow, that approach... may actually be a good idea if you can find a way to generate all dictionary code-points in like 1-10 bytes... – Magic Octopus Urn – 2017-07-21T01:12:24.693

@adnan Raises eyebrows Try it online!

– Magic Octopus Urn – 2017-07-21T01:20:09.820

@MagicOctopusUrn Hmm, that also contains some 'non-dictionary' words, it is possible that this approach could be smaller. – Adnan – 2017-07-21T01:33:59.293

1@adnan that was my first attempt, I'm sure you could knock it outta the park. – Magic Octopus Urn – 2017-07-21T01:48:29.713

5

Ruby, 120 bytes

j=3
$><<?a
"  5  T &  }   <    ".bytes{|i|puts
8.times{|k|$><<%w{dehydro chlori ge n at ion e s}[k]*(j>>7-k&1)}
j+=i-31}

Prints the following. Each word is built from the 8 strings above, using the binary digits of j to select. On each iteration of the loop, j is incremented by the ASCII value of the characters in the string in quotes, minus 31.

a
es
ion
ions
nates
nation
nations
chlorine
chlorines
chlorinate
chlorinates
chlorination
dehydrogenate
dehydrogenates
dehydrogenation
dehydrogenations
dehydrochlorinate
dehydrochlorinates
dehydrochlorination
dehydrochlorinations

Level River St

Posted 2017-07-20T15:17:12.367

Reputation: 22 049

4

Pyth, 74 bytes

Psychopathologically adventuresomenesses

.e:"psychopathologicallyadventuresomenesses"b+bhkiR36"GGGGBKMMKKM6K6M0K0K0

Try it online! It outputs:

['a', 'al', 'all', 'ally', 'logic', 'advent', 'venture', 'ventures', 'adventure', 'adventures', 'venturesome', 'pathological', 'adventuresome', 'pathologically', 'venturesomeness', 'psychopathologic', 'adventuresomeness', 'psychopathological', 'adventuresomenesses', 'psychopathologically']

Which, once formatted yields:

a
al
all
ally
logic
advent
venture
ventures
adventure
adventures
venturesome
pathological
adventuresome
pathologically
venturesomeness
psychopathologic
adventuresomeness
psychopathological
adventuresomenesses
psychopathologically

Explanation

The key was to choose two words that complement each other. I chose "psychopathologically" and "adventuresomenesses" thanks to a little tool I wrote. Using these two words, for any length we can find substrings which are actual words of the provided list. All the possible decompositions are demonstrated by:

a al all ally logic psycho logical          logically pathologic             pathological               pathologically                 psychopathologic                   psychopathological                     psychopathologically
a ad ess ness esses advent venture ventures adventure adventures venturesome              adventuresome                venturesomeness                  adventuresomeness                    adventuresomenesses

The next step is just to get the list of the indexes for a given decomposition. For my decomposition, I chose: 16 16 16 16 11 20 22 22 20 20 22 6 20 6 22 0 20 0 20 0, which are indexes in the concatenated strings: psychopathologicallyadventuresomenesses.

Finally, write a program which just loops over the indexes and display the substring at each given index with increasing length.

For saving bytes, I stored the indexes in a base 36 string. Indeed, GGGGBKMMKKM6K6M0K0K0 is the list of my indexes in base 36 (because my highest index is 22, I could have used base 23).

Program explanation

.e:"psychopathologicallyadventuresomenesses"b+bhkiR36"GGGGBKMMKKM6K6M0K0K0

                                                 iR36"GGGGBKMMKKM6K6M0K0K0    # For each character in the string, convert from base 36 to base 10
.e                                                                            # Loop over indexes: b are the indexes, h their position
  :"psychopathologicallyadventuresomenesses"b+bhk                             # In "psy...ses", select the substring at index b and of length k + 1

Jim

Posted 2017-07-20T15:17:12.367

Reputation: 1 442

psychopathologically - "In terms of the scientific study of mental disorders." Interesting. – Magic Octopus Urn – 2017-07-25T19:17:33.470

3

C#, 259 bytes

_=>{var a=new int[7].Select((n,i)=>"abasers".Substring(0,i+1)).ToList();a.Add("abacuses");a.AddRange(new int[12].Select((n,i)=>(i>10?"un":"")+"character"+"|s|ed|ful|ised|istic|istics|isation|isations|istically|ologically|istically|".Split('|')[i]));return a;}

Some obvious room for golfing still but I've run out of time now. I know it's longer than hard coding so will fix it when I get some time later on.

TheLethalCoder

Posted 2017-07-20T15:17:12.367

Reputation: 6 930

Woops is actually even longer because I need to include using System.Linq; – TheLethalCoder – 2017-07-20T16:02:58.113

4Just returning them in a string split by spaces is like 245. – Magic Octopus Urn – 2017-07-20T16:29:07.427

@MagicOctopusUrn I know that's what I said in my answer... – TheLethalCoder – 2017-07-20T19:20:46.893

3

05AB1E, 130 68 bytes

-62 bytes thanks to Erik the Outgolfer

743222’€Ü†š ƒ´aî³eros €‡a•¿f²Ñns …¿en®íizers ‚ÀÙŠs ‡åØŽ’#‚øε`ηRs£R}˜

Try it online!

Takes as many prefixes as needed from each of the following words:

amusers
carabinero
foraminiferans
photosensitizers
videoconferencings
radiopharmaceuticals

Prints these words in an array:

a
am
amu
amus
amuse
amuser
amusers
carabine
carabiner
carabinero
carabineros
foraminifera
foraminiferan
foraminiferans
photosensitizer
photosensitizers
videoconferencing
videoconferencings
radiopharmaceutical
radiopharmaceuticals 

Riley

Posted 2017-07-20T15:17:12.367

Reputation: 11 345

You can significantly golf this (-43). – Erik the Outgolfer – 2017-07-20T17:28:21.283

And another -13. – Erik the Outgolfer – 2017-07-20T17:34:20.337

Some other -6 too... (sadly I can't replace 743222 with •B/™•) – Erik the Outgolfer – 2017-07-20T17:42:08.433

Yeah, you don't need the S so it's -62 bytes. ;) – Erik the Outgolfer – 2017-07-20T17:47:31.980

@EriktheOutgolfer Thanks! I was trying to do something like that last one, but I couldn't make it work. Do you mind explaining how the compressed strings works? – Riley – 2017-07-20T17:48:45.473

means "no-implicit-space compressed string". Then there's the compressor which would compress the words. – Erik the Outgolfer – 2017-07-20T17:51:28.773

Note that only 100 different chars are used to compress words, the others (like s) are put verbatim into the string. Every word is 2 chars, and there are 10000 words. Each char is assigned an index from 00 to 99. Two such chars make a 4-digit number (leading zero matters) from 0000 to 9999. That's the index of the particular word. The chars are in order: €‚ƒ„…†‡ˆ‰Š‹ŒŽ•–—™š›œžŸ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîï. Quote types include (normal), (titlecase), (uppercase) and (no implicit space). – Erik the Outgolfer – 2017-07-20T17:52:22.267

3

Bubblegum, 66 bytes

00000000: 6d8b 410a 0020 0804 bf6a 4407 a134 5aff  m.A.. ...jD..4Z.
00000010: 4fe6 29ac 93ce b0a3 543a ad06 3f6c e769  O.).....T:..?l.i
00000020: 46f3 3ae2 b218 abc4 2cab d389 a805 82aa  F.:.....,.......
00000030: fee1 6e43 2444 62df 0f46 4a1e f356 8cf1  ..nC$Db..FJ..V..
00000040: 73d8                                     s.

Output:

o`al`res`alit`reset`preset`present`rational`represent`rationales`annotations`connotations`connotational`representation`representations`representational`misrepresentation`misrepresentations`representationalism`representationalisms

Try it online!

The words and separator were selected by simulated annealing:

from __future__ import print_function
import math
import random
import zlib

wordlists = \
    [[chr(x).encode() for x in [9, 10] + list(range(32, 127)) if not chr(x).encode().isalpha()]] + \
    [open('wordListsByLength/{}.txt'.format(n), 'rb').read().splitlines() for n in range(1, 21)]

words = [random.choice(wordlist) for wordlist in wordlists]

temperature = 10.
score = 9999
best = score

while True:
    old_score = score
    n = random.randrange(len(wordlists))
    old_word = words[n]
    words[n] = random.choice(wordlists[n])
    z = zlib.compressobj(9, zlib.DEFLATED, -zlib.MAX_WBITS, 9)
    score = len(z.compress(words[0].join(words[1:])) + z.flush())
    if score > old_score and random.random() >= math.exp((old_score - score) / temperature):
        words[n] = old_word
        score = old_score
    else:
        temperature *= .99999
        if score < best:
            best = score
            print(best, repr(words[0].join(words[1:])))

Anders Kaseorg

Posted 2017-07-20T15:17:12.367

Reputation: 29 242

2

Bubblegum, 78 bytes

00000000: 654b c301 4431 10bd a7cb d876 9a5f efe7  eK..D1.....v._..
00000010: 781e 2080 ee55 0488 ffc8 9f69 e86f a5ff  x. ..U.....i.o..
00000020: ce00 0b98 202e 34ed d701 a464 bf59 35fb  .... .4....d.Y5.
00000030: 23d7 9192 b948 7c79 f351 0c8b f4ee 06e4  #....H|y.Q......
00000040: 8b05 1a33 77c8 1bcf 7f58 7577 e113       ...3w....Xuw..

Try it online!

ovs

Posted 2017-07-20T15:17:12.367

Reputation: 21 408

2

Ruby, 107 bytes

p(z=%w{o or for form ultra})+[z[3],c="centrifug",z[4]+c].product(%w{ed ing ally ation ations}).map{|i|i*""}

Prints the following array.

["o", "or", "for", "form", "ultra", "formed", "forming", "formally", "formation", "formations", "centrifuged", "centrifuging", "centrifugally", "centrifugation", "centrifugations", "ultracentrifuged", "ultracentrifuging", "ultracentrifugally", "ultracentrifugation", "ultracentrifugations"

Changing the p for puts (with trailing space) gives the following at a cost of an additional 4 bytes.

o
or
for
form
ultra
formed
forming
formally
formation
formations
centrifuged
centrifuging
centrifugally
centrifugation
centrifugations
ultracentrifuged
ultracentrifuging
ultracentrifugally
ultracentrifugation
ultracentrifugations

Level River St

Posted 2017-07-20T15:17:12.367

Reputation: 22 049

1

Japt, 119 bytes

`av„v„dvjvjsvj¤vj¤svfœejvqvqsvq‚vqˆgvqizƒvqÄKcvqÄKcsvqizÂ\nvqizÂ\nsvq‰tkvqologkv·sqizÂ\ns`d'j`Ê@`'k`Ŝ§`'q`֋a×` q'v ·

Try it online!

Prints:

a
an
and
hand
hands
handle
handles
freehand
character
characters
charactered
charactering
characterizes
characteristic
characteristics
characterization
characterizations
characteristically
characterologically
mischaracterizations

Oliver

Posted 2017-07-20T15:17:12.367

Reputation: 7 160