Woody Wörter, dünne Wörter


35

Hinweis: Diese Frage enthält einige unhöfliche Wörter.

In dieser klassischen Monty Python-Skizze ist ein implizites Puzzle enthalten (Sie können das Skript auch online bereitstellen ).

Verschiedene Phrasen werden als "holzig" oder "dünn" und eine als "PVC" beschrieben.

Beantworten Sie einen Ausdruck mit seinem Typ gemäß den folgenden Listen:

woody:

gone
sausage
seemly
prodding
vacuum
bound
vole
caribou
intercourse
pert
thighs
botty
erogenous zone
ocelot
wasp
yowling

tinny:

litter bin
newspaper
antelope
recidivist
tit
simpkins

PVC:

leap

Regeln

  • Ist der Eingang zu einem der oben genannten Listen gehört, soll die Ausgabe sein woody, tinnyoder PVC, entsprechend.
  • Alle Eingaben erfolgen in Kleinbuchstaben.
  • Für Phrasen, die oben nicht aufgeführt sind, ist jedes Verhalten akzeptabel.
  • Die wenigsten Bytes in der Antwort gewinnen.

@AJFaraday Ich würde empfehlen, einige Zeit auf der Website zu verbringen und einige Fragen zu beantworten, bevor Sie sich der schwierigen Aufgabe des Schreibens von Herausforderungen widmen. Wenn Sie sich bereit fühlen, verwenden Sie die Sandbox , zumindest für Ihre ersten Herausforderungen und auch für nicht-triviale Herausforderungen.
Adám

27
Diese Empfehlung gefällt mir überhaupt nicht! Bitte poste weiterhin Herausforderungen, auch wenn du nicht gerne antwortest. Es ist natürlich schön, sich andere Herausforderungen anzuschauen, um ein Gefühl für die Site zu bekommen, und ich empfehle auch die Sandbox, aber bitte schreibe weiterhin Herausforderungen! :)
Stewie Griffin

5
Wenden wir also Logik auf eine Monty Python-Skizze an? ...Ausgezeichnet!
BruceWayne

@ BruceWayne das ist genau das, was wir tun.
AJFaraday,

You may choose how to deal (or ignore) with casing in input and output.Bedeutet dies zur Verdeutlichung, dass wir erwarten können, dass die Eingabe in Großbuchstaben erfolgt?
Urous

Antworten:


4

Stax , 30 25 Bytes

ï═H♣║GÇX→ΩM+@╢^j╬♪►╨╝ô╤c\

Führen Sie es aus und debuggen Sie es

Die kommentierte ASCII-Darstellung ist dies. Diesen Algorithmus habe ich nicht erfunden. Es ist schamlos von Jonathan Allens Python-Lösung abgerissen .

9@                  10th character, modularly indexed
`#!z"pi0$L+%v9`X    store "tinny pvc woody" in the x register
3(                  keep only the first 3 characters ("tin")
#                   how many times the 10th char occurs in tin? (a)
y.eaI               index of "ea" in the input or -1 (b)
+                   a + b (one of -1, 0, or 1)
xj@                 modularly indexed word in x

Führen Sie dieses aus


Diese Antwort ist in Ordnung, aber der String-Literal-Kompressor ist fehlerhaft. Manchmal wird ein 5 Zeichen langes Ergebnis (wenn Sie `, 7 einschließen) für 4 Zeichen lange Strings erzeugt.
Weijun Zhou

Es ist nicht immer gewährleistet, dass die Komprimierung zu einem geringeren Ergebnis führt. Nur normalerweise für englische Streicher. Das ist kein Fehler. Wenn Sie einen Fall haben, in dem eine Zeichenfolge in doppelten Anführungszeichen kleiner ist, verwenden Sie stattdessen diese.
rekursive

Ich dachte, es wäre wie bei Jelly, die immer die kürzeste Darstellung findet (vielleicht sollte die Beschreibung dann umformuliert werden?)
Weijun Zhou

Keine Ursache. Ich finde das Sprechen can help youetwas verwirrend, aber logischerweise in Ordnung.
Weijun Zhou

Hm, ja, der Wortlaut ist irgendwie irreführend.
rekursive

35

Python 2 , 99 73 65 64 63 Bytes

lambda s:'PVC'*('ea'in s)or'wtoiondnyy'[s[-2:]in'instperit'::2]

Probieren Sie es online!

Alternativen auch mit 63 Bytes:

lambda s:'PVC'*('ea'in s)or'wtoiondnyy'[s[-6::5]in'dtenmsr'::2]
lambda s:'PVC'*('ea'in s)or'wtoiondnyy'[s[::5]in'lrinaosit'::2]

23
Upvoted, weil Python zur Lösung einer Python-Herausforderung verwendet wurde.
Brain Guider

10
@AnderBiguri, geben Sie Ihre Stimme basierend auf der Lösung selbst ab und nicht auf der verwendeten Sprache.
Shaggy

24
@ Shaggy AFAIK die Wahl der Sprache ist einer der lustigen Teile von PPCG! Ich mag die Lösung, weil es in Python ist . Wir haben bereits die Bytes, um zu sehen, welche gewinnt
Brain Guider

2
Ja, Stimmen im Codegolf sollten nur für den Ansatz abgegeben werden, der als der beste oder kreativste gilt, da der Gewinner anders bestimmt wird. Es wäre auch langweilig, wenn alle nur spezielle Codegolf-Sprachen verwenden würden, anstatt mit allgemeineren kreativ zu werden
Gimli

5
Ich stimme zu, es kann viele Gründe geben, eine bestimmte Antwort zu mögen. Aber selbst wenn die Leute von "Python für Monty Python" so begeistert sind, ist es immer noch traurig zu sehen, dass die Upvoter sich nicht die Mühe machen, ein wenig nach unten zu scrollen, und eine andere Python- Antwort zu würdigen, die eigentlich unkonventioneller und sogar unkonventioneller ist Etwas kürzer ...
Kirill L.

15

Python 2 , 62 Bytes

lambda n:'wtPoiVonCdn yy'[hash(n)%97%78%28%15%2+('ea'in n)::3]

Probieren Sie es online!

Wie?

Diese Übermittlung verwendet die Tatsache, dass die hashFunktion für Zeichenfolgen in Python 2 stabil ist. Jede gültige Eingabe hat eine gültige Ausgabe. Das brachial erzwungene wiederholte Modulo %97%78%28%15%2kehrt 1für alle blechernen und PVC- Wörter und zurück0 für holzige Wörter zurück. Indem ('ea' in n)wir den Wert von dazu addieren , erhalten wir 2anstelle 1der Eingabe 'Sprung'. Hier ist eine Tabelle aller Werte:

+----------------+----------------------+----------------+-------------+-------+
| word           | hash                 | %97%78%28%15%2 | +('ea'in n) | type  |
+----------------+----------------------+----------------+-------------+-------+
| leap           | 5971033325577305778  | 1              | 2           | PVC   |
+----------------+----------------------+----------------+-------------+-------+
| litter bin     | 2393495108601941061  | 1              | 1           | tinny |
| newspaper      | 1961680444266253688  | 1              | 1           | tinny |
| antelope       | -2930683648135325182 | 1              | 1           | tinny |
| recidivist     | -1480015990384891890 | 1              | 1           | tinny |
| tit            | -1495230934635649112 | 1              | 1           | tinny |
| simpkins       | 672871834662484926   | 1              | 1           | tinny |
+----------------+----------------------+----------------+-------------+-------+
| gone           | 3644900746337488769  | 0              | 0           | woody |
| sausage        | 4880706293475915938  | 0              | 0           | woody |
| seemly         | -8112698809316686755 | 0              | 0           | woody |
| prodding       | 7325980211772477495  | 0              | 0           | woody |
| vacuum         | -5283515051184812457 | 0              | 0           | woody |
| bound          | -6522768127315073267 | 0              | 0           | woody |
| vole           | -7823607590901614336 | 0              | 0           | woody |
| caribou        | -3644594841083815940 | 0              | 0           | woody |
| intercourse    | 2499732157679168166  | 0              | 0           | woody |
| pert           | 4142553773863848247  | 0              | 0           | woody |
| thighs         | -3490317966011085195 | 0              | 0           | woody |
| botty          | -6522767127163072681 | 0              | 0           | woody |
| erogenous zone | 7046120593231489339  | 0              | 0           | woody |
| ocelot         | -6961879712146820842 | 0              | 0           | woody |
| wasp           | -3668927459619339511 | 0              | 0           | woody |
| yowling        | 6823632481520320220  | 0              | 0           | woody |
+----------------+----------------------+----------------+-------------+-------+

Der zurückzugebende Typ wird jetzt aus der Zeichenfolge extrahiert, 'wtPoiVonCdn yy'indem jedes dritte Zeichen beginnend mit dem berechneten Index verwendet wird.


10

JavaScript (ES6), Chrome / Edge, 54 Byte

Da das Verhalten parseInt()bei großen Eingaben mit einem Radix von 36 von der Implementierung abhängt , funktioniert dies nicht mit SpiderMonkey (Firefox).

s=>[,'PVC',,'Tinny'][parseInt(s+383,36)%69%7]||'Woody'

Probieren Sie es online!

Wie?

Die Hash-Funktion gibt 3 für Tinny-Wörter, 1 für PVC und entweder 0 , 4 , 5 oder 6 für Woody-Wörter zurück. Die mit einem Sternchen markierten Wörter werden implizit abgeschnitten, da das Leerzeichen von parseInt () als ungültiges Zeichen betrachtet wird .

word           | +383           | base 36 -> decimal    | mod 69 | mod 7
---------------+----------------+-----------------------+--------+------
gone           | gone383        |           36318994131 |   54   |   5
sausage        | sausage383     |      2874302392811475 |   42   |   0
seemly         | seemly383      |        80120017777107 |    6   |   6
prodding       | prodding383    |     94214834629477200 |   12   |   5
vacuum         | vacuum383      |        88266035564499 |   60   |   4
bound          | bound383       |          916101808275 |    6   |   6
vole           | vole383        |           68967369939 |   39   |   4
caribou        | caribou383     |      1249086300450771 |   63   |   0
intercourse    | intercourse383 | 3.183324871563264e+21 |   11   |   4
pert           | pert383        |           55312791699 |   21   |   0
thighs         | thighs383      |        83184557510739 |    6   |   6
botty          | botty383       |          916052399571 |   63   |   0
erogenous zone | erogenous (*)  |        41664605989780 |    7   |   0
ocelot         | ocelot383      |        68678794158483 |   39   |   4
wasp           | wasp383        |           70309896339 |   63   |   0
yowling        | yowling383     |      3523299657958227 |   39   |   4
---------------+----------------+-----------------------+--------+------
litter bin     | litter (*)     |            1301413923 |   24   |   3
newspaper      | newspaper383   |   3081816298632183000 |    3   |   3
antelope       | antelope383    |     38980419895881940 |   24   |   3
recidivist     | recidivist383  | 129824740122576960000 |    3   |   3
tit            | tit383         |            1785109395 |   45   |   3
simpkins       | simpkins383    |    104264583727840850 |   24   |   3
---------------+----------------+-----------------------+--------+------
leap           | leap383        |           46576922259 |   57   |   1

Vorherige Version, 59 57 Bytes

s=>['Woody','Tinny','PVC'][82178>>parseInt(s,35)%50%26&3]

Probieren Sie es online!

Wie?

Below are the different steps of the function for each input. The result of the first modulo is an approximation within the precision of JS numbers and is mathematically invalid for intercourse.

input          | base-35 -> dec.   | %50 | %26 | 00000000010100000100000010
---------------+-------------------+-----+-----+---------------------------
gone           |            716219 |  19 |  19 |      00------------------>
sausage        |       52042888324 |  24 |  24 | 00----------------------->
seemly         |        1492249219 |  19 |  19 |      00------------------>
prodding       |     1659396207121 |  21 |  21 |    00-------------------->
vacuum         |        1643736697 |  47 |  21 |    00-------------------->
bound          |          17573443 |  43 |  17 |        00---------------->
vole           |           1359274 |  24 |  24 | 00----------------------->
caribou        |       22625709220 |  20 |  20 |     00------------------->
intercourse    | 51532867489988450 |  48 |  22 |   00--------------------->
pert           |           1089999 |  49 |  23 |  00---------------------->
thighs         |        1549436973 |  23 |  23 |  00---------------------->
botty          |          17572449 |  49 |  23 |  00---------------------->
erogenous zone |    33308397234728 |  28 |   2 |                       00->
ocelot         |        1279159344 |  44 |  18 |       00----------------->
wasp           |           1385255 |   5 |   5 |                    00---->
yowling        |       63810499496 |  46 |  20 |     00------------------->
litter bin     |        1131250042 |  42 |  16 |         01--------------->
newspaper      |    52754217228642 |  42 |  16 |         01--------------->
antelope       |      687218151914 |  14 |  14 |           01------------->
recidivist     |  2160354371100934 |  34 |   8 |                 01------->
tit            |             36184 |  34 |   8 |                 01------->
simpkins       |     1835782971008 |   8 |   8 |                 01------->
leap           |            917900 |   0 |   0 |                         10


9

Java 8, 81 80 67 bytes

s->s.charAt(2)<98?"PVC":s.matches(".*(.p.|is?t).*")?"tinny":"woody"

Regex from @MatrinEnder's Retina answer.

Try it online.

Original answer: 81 80 bytes

s->"anetisilire".contains(s.substring(0,2))?"tinny":s.charAt(2)<98?"PVC":"woody"

Try it online.

Explanation:

s->                  // Method with String as both parameter and return-type
  "anetisilire".contains(s.substring(0,2))?
                     //  If the first two letters of the input are present in "anetisilire"
    "tinny"          //   Output "tinny"
   :s.charAt(2)<98?  //  Else-if the third character of the input is an 'a'
    "PVC"            //   Output "PVC"
   :                 //  Else:
    "woody"          //   Output "woody"

Additional explanation:

litter bin:  anetisi(li)re
newspaper:   a(ne)tisilire
antelope:    (an)etisilire
recidivist:  anetisili(re)
tit:         ane(ti)silire
simpkins:    aneti(si)lire
  1. None of the first two letters of the woody words are present in this String above, nor is le from leap.
  2. None of the woody words has an a as third letter, so that is used to get leap to PVC if it's not a tinny word.
  3. Everything else is a word from the woody list.

2
It's really cool to be able to read through this problem-solving kind of thinking :)
AJFaraday

6

Haskell, 61 bytes

f(a:b:_)|b=='i'||elem a"ran"="tinny"|a=='l'="PVC"|1>0="woody"

Try it online!

Uses this hand-found logic:

  • Words with second letter i or first letter r, a, or n are tinny
  • Any other word starting with l (leap) is PVC
  • Anything else is woody

Lynn saved a byte by checking leap by its first letter.


1
Nice! You can save a byte by detecting "leap" with |a=='l'="PVC".
Lynn

5

QuadS, 34 32 bytes

Shamelessly uses Martin Ender's system, including the regex from Peter Norvig's regex golfer.

⊃⍵
ea
.p.|is?t
$
PVC
tinny
woody

Try it online!

⊃⍵ pick the first occurrence of

ea "ea"
.p.|is?t "p" surrounded by letters OR "i" and "t" with an optional "s" between them
$ end of input

… but substituting the matches with the corresponding one of the following:

PVC
tinny
woody


The equivalent 43-byte Dyalog APL function is:

'ea' '.p.|is?t' '$'S'PVC' 'tinny' 'woody'

Try all the cases online!


5

C (gcc), 81 bytes

h;f(char*s){puts(strchr("HzYfPW",h=*s^s[1]<<2&127)?"Tinny":h<120?"Woody":"PVC");}

Try it online!

The first order of business was to find some hash function that would separate the words into their categories. After some fiddling about I stumbled upon (s[0] ^ (s[1] << 2)) & 0x7f, where the 0x7f is of course there to bring it down to printable ASCII levels. This produced the following information (the tables are sorted, but not the resulting strings):

Woody:
----
erogenous zone  - 45
prodding        8 56
yowling         E 69
vole            J 74
intercourse     Q 81
thighs          T 84
gone            [ 91
botty           ^ 94
bound           ^ 94
ocelot          c 99
pert            d 100
caribou         g 103
seemly          g 103
vacuum          r 114
wasp            s 115
sausage         w 119

[wg8r^JgQdT^-csE

Tinny:
----
litter bin      H 72
tit             P 80
simpkins        W 87
antelope        Y 89
recidivist      f 102
newspaper       z 122

HzYfPW

PVC:
----
leap            x 120

x

The hash collisions don't matter, since they are confided to the same category. We only have to check if the resulting hash is in the Tinny hashes string ("HzYfPW"), since the Woody hashes are all below the PVC hash (120). If 120 or higher, and not a Tinny word, it must be PVC. If not a Tinny word, and the hash is below 120, then it must be a good, woody sort of word.


4

x86 32-bit machine code, 39 bytes

Hexdump:

69 01 47 6f 61 2c c7 02 50 56 43 00 3a c4 74 16
c7 02 77 6f 6f 64 85 c0 78 06 c7 02 74 69 6e 6e
66 c7 42 04 79 00 c3

The hash function is multiplication by a "magic" number 0x2c616f47. There are only 6 numbers that can be used with this code.

First of all, it writes PVC to the output. This will be overwritten, if needed.

After hashing, it checks for the PVC word; the check is al = ah - I chose it because it's a small 2-byte instruction. Then, it writes either wood or tinn, depending on the sign of the hashed result. Then, it writes y.

Assembly code:

    imul eax, [ecx], 0x2c616f47;
    mov dword ptr [edx], 'CVP';
    cmp al, ah;
    je done;
    mov dword ptr [edx], 'doow';
    test eax, eax;
    js skip;
    mov dword ptr [edx], 'nnit';
skip:
    mov word ptr [edx + 4], 'y';
done:
    ret;

4

Jelly,  27  26 bytes

⁵ịe“Ṗµ»_⁼“ḣG»$ị“©LẈḊ¶$Ḍ»Ḳ¤

A monadic link accepting and returning lists of characters.

Try it online!

How?

⁵ịe“Ṗµ»_⁼“ḣG»$ị“©LẈḊ¶$Ḍ»Ḳ¤ - Link: list of characters, W   e.g. "gone"  "leap"  "newspaper"
⁵                          - literal ten                  10
 ị                         - index into (1-based & modular)     'o'     'e'     'n'
   “Ṗµ»                    - compression of characters    "int"
  e                        - exists in?                          0       0       1
              $            - last two links as a monad
          “ḣG»             -   compression of characters  "leap"
         ⁼                 -   equal?                            0       1       0
        _                  - subtract                            0      -1       1
                         ¤ - nilad followed by link(s) as a nilad:
                “©LẈḊ¶$Ḍ»  -   compression of characters  "tinny PVC woody"
                         Ḳ -   split at spaces            ["tinny","PVC","woody"]
               ị           - index into (1-based & modular)     "woody" "PVC"   "tinny"

3

Haskell, 75 bytes

-2 bytes thanks to Laikoni.

f"leap"="PVC"
f s|take 2s`elem`words"li ne ti si an re"="tinny"|1>0="woody"

Try it online!

RIP enklact.


f"leap"="PVC";f s| is shorter than f s|s=="leap"="PVC"|.
Laikoni

3

Dirty, 73 57 54 bytes

⇖'le'⇗≐∀⭦)Ẃ'nar'⇗{=]}⭨'i'=]'woody'‼␛['tinny'‼␛('PVC'‼␛

Try it online!

Explained:

For a similar older version (I'll update it when I stop golfing it)

␛‼'CVP'⇨⇖'leap'⇗≡⊭◌⬅Ẃ'nar'⇗{=]}1ẁ'i'=]'woody'‼␛['tinny'‼␛

The body of this is made up of:

⇖            put the input into the left stack
 'leap'      push the string "leap"
       ⇗     put that string into the right stack
        ≡    are the left and right stacks equal
         ⊭   logically negate
          ◌  skip next instruction if true
           ⬅ change direction to leftwards

If we end up going left, then we have:

       ⇨⇖'leap'⇗≡⊭◌ does stuff to the stacks, but isn't relevant
  'CVP'              push the string "PVC" (reversed, because we're going left)
 ‼                   print the string on the main stack
␛                    exit the program (this should wrap into the other exit, but that isn't working yet)

Otherwise, this checks if the string starts with any of "nar":

Ẃ           wipe the right stack
 'nar'      push the string "nar"
       ⇗    move string to right stack
        {
         =  compare the top of the left and right stacks
          ] goto matching bracket if true
        }   consuming loop while the right stack is true

We then check if the second letter is "i":

1        push the number 1
 ẁ       drop ^ number of elements off of the left stack
  'i'    push "i"
     =   are the top of the left and middle stacks equal
       ] goto matching bracket if true

If they all fall through, we run into

'woody'   push the string "woody"
       ‼  print the string on the main stack
        ␛ exit the program

If we ended up jumping, we wrap around to

[          matching bracket for the goto
 'tinny'   push the string "tinny"
        ‼  print the string on the main stack
         ␛ exit the program

3

C# 97 Bytes

string t(string w)=>w[0]!='p'&new[]{10,9,8,3}.Contains(w.Length)?"tinny":w[0]=='l'?"pvc":"woody";

I went looking for a pattern in the length of the strings and found they are unique except for lengths 4 and 8. So I special case those by looking at the first characters. Oh well, it's still shorter than some answers. :)


1
You know, when Martin Ender found a simple rule for these lists, just about every answer implemented that same solution, one way or another. It's cool to see an original approach. :)
AJFaraday

Thanks for the feedback. :) I didn't read other solutions before attempting mine.. perhaps there is still a more elegant solution yet to be discovered.. I so wish they all had unique lengths then this would be The Solution.
lee

2
string t(string w)=> can be just w=>. You can convert 'p' and other characters to their int representations I think. You can remove the trailing semi colon
TheLethalCoder

3

Python, 59 bytes

lambda w:"wtPoiVonCdn yy"[(w*4)[9]in"tin"or(w[2]<"b")*2::3]

Try it online!

Uses the indexing from ovs's Python answer but a simpler and shorter choice function:

If the tenth letter of the word, w, with wrapping ((w*4)[9] - where w*4 repeats w four times) is a letter in the word tin (in"tin") then the word is tinny, otherwise if the third letter (w[2]) is an a (<'b') then the word is PVC otherwise the word is woody.

...this 59 does the same job:

lambda w:"wtPoiVonCdn yy"[[(w*4)[9]in"tin",2][w[2]<"b"]::3]

2

C, 107 bytes

k;f(char*s){for(k=0;*s;)k+=*s++;k%=100;puts(k-18?(k-5)*(k-81)*(k-56)*(k-78)*(k-37)?"woody":"tinny":"PVC");}

Try it online!


2

Batch, 145 bytes

@set/ps=
@if %s%==leap echo PVC&exit/b
@for %%s in (a n r)do @if %s:~,1%==%%s echo tinny&exit/b
@if %s:~1,1%==i echo tinny&exit/b
@echo woody

Takes input on STDIN. Explanation: After checking for leap, tinny words either begin with one of the letters a, n or r or their second letter is i.


2

CJam, 35 bytes

1b_856%338<\418=-"woodytinnyPVC"5/=

Try it online!

I completely forgot that I had started a brute force search for short expressions to hash the woody and tinny strings into two classes. I just found the console window where the search ran and it turns out it actually found something...

Explanation

1b     e# Sum the code points of the input string.
       e# The result is unique for each input, except "pert" and "wasp" which
       e# both sum to 443. But they're both woody, so that's fine.
_      e# Duplicate.
856%   e# Take the sum modulo 856.
338<   e# Check whether the result is less than 338. That's true for all
       e# tinny words.
\      e# Swap with the other copy of the sum.
418=   e# Check whether the sum is equal to 418, which identifies "leap".
-      e# Subtract. Gives -1 for "leap", 1 for tinny words and 0 for woody words.
"woodytinnyPVC"5/
       e# Create the list ["woody" "tinny" "PVC"].
       e# Select the correct string.

1

Excel, 81 bytes

=IF(ISNUMBER(FIND(LEFT(A1,2),"anetisilire")),"tinny",IF(A1="leap","PVC","woody"))

Using the 'anetisilire' method.



1

JavaScript, 60, 50

EDIT I saw all the other regex answers. I guess I'm just blind. Anyway, here's one using the same regex

i=="leap"?"PVC":/.p.|is*t/.test(i)?"tinny":"woody"

Also, now, it beats the other JS answer

Snippet:

let test = i => i=="leap"?"PVC":/.p.|is*t/.test(i)?"tinny":"woody"

let woody = `gone
sausage
seemly
prodding
vacuum
bound
vole
caribou
intercourse
pert
thighs
botty
erogenous zone
ocelot
wasp
yowling`;
console.log("THESE SHOULD BE woody");
woody.split("\n").forEach(el => console.log(test(el)));
let tinny = `litter bin
newspaper
antelope
recidivist
tit
simpkins`;
console.log("THESE SHOULD BE tinny");
tinny.split("\n").forEach(el => console.log(test(el)));
console.log("THIS SHOULD BE PVC");
console.log(test("leap"));

Old answer

I didn't see any with regex yet, so I thought I'd give it a try

i=="leap"?"PVC":/[gyuz]|[or][tl]|as/.test(i)?"woody":"tinny"

Not sure if this counts as 60 or more because I didn't include a return statement. Will add a snippet when I get on my computer

Edit: Snippet

let test = i => i=="leap"?"PVC":/[gyuz]|[or][tl]|as/.test(i)?"woody":"tinny"

let woody = `gone
sausage
seemly
prodding
vacuum
bound
vole
caribou
intercourse
pert
thighs
botty
erogenous zone
ocelot
wasp
yowling`;
console.log("THESE SHOULD BE woody");
woody.split("\n").forEach(el => console.log(test(el)));
let tinny = `litter bin
newspaper
antelope
recidivist
tit
simpkins`;
console.log("THESE SHOULD BE tinny");
tinny.split("\n").forEach(el => console.log(test(el)));
console.log("THIS SHOULD BE PVC");
console.log(test("leap"));

Durch die Nutzung unserer Website bestätigen Sie, dass Sie unsere Cookie-Richtlinie und Datenschutzrichtlinie gelesen und verstanden haben.
Licensed under cc by-sa 3.0 with attribution required.