Woody words, tinny words

35

4

Note: There are some rude words in this question.

There's an implicit puzzle posed in this classic Monty Python sketch (you can also ready the script online).

Various phrases are described as being 'woody' or 'tinny', and one is described as being 'PVC'.

Given a phrase, respond with its type according to the following lists:

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

Rules

  • If the input belongs to one of the above lists, the output should be woody, tinny or PVC, accordingly.
  • All input is lower case.
  • Any behaviour is acceptable for phrases which are not listed above.
  • The fewest bytes in the answer wins.

AJFaraday

Posted 2018-03-05T11:13:17.053

Reputation: 10 466

@AJFaraday I'd recommend spending some time on the site and answering some questions before embarking on the difficult task of writing challenges. When you feel ready, use the sandbox, at least for your first few challenges and for any non-trivial challenges too.

– Adám – 2018-03-05T11:38:14.573

30I don't like that recommendation at all! Please continue posting challenges, even if you don't like answering. It's of course nice to look at other challenges to get a feel of the site, and I recommend the Sandbox too, but please keep writing challenges! :) – Stewie Griffin – 2018-03-05T13:30:30.133

6So, we're to apply logic to a Monty Python sketch? ...excellent! – BruceWayne – 2018-03-05T21:47:09.290

@BruceWayne that is precisely what we’re doing. – AJFaraday – 2018-03-05T23:29:28.280

You may choose how to deal (or ignore) with casing in input and output. To clarify, does this mean we can expect input to be in uppercase? – Οurous – 2018-03-06T05:59:13.150

@Ourous let’s keep it simple. All input is lower case. – AJFaraday – 2018-03-06T06:16:33.913

Answers

4

Stax, 30 25 bytes

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

Run and debug it

The commented ascii representation is this. I didn't invent this algorithm. It's shamelessly ripped off Jonathan Allen's python solution.

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

Run this one

recursive

Posted 2018-03-05T11:13:17.053

Reputation: 8 616

This answer is OK, but the string literal compressor is buggy, it sometimes produce 5 character long result(if you include the `, 7) for 4-character long strings. – Weijun Zhou – 2018-03-05T23:02:02.173

Compression isn't always guaranteed to produce a smaller result. Just usually for english strings. That's not a bug. If you have a case where a double quoted string is smaller, just use that instead. – recursive – 2018-03-05T23:04:34.150

I thought it was like Jelly's which always finds the shortest representation (maybe the description should be reworded then?) – Weijun Zhou – 2018-03-05T23:06:25.543

Never mind. I think saying can help you is a little confusing but is OK logically. – Weijun Zhou – 2018-03-05T23:09:55.267

Hm, yes, the wording is kind of misleading. – recursive – 2018-03-05T23:17:40.777

37

Python 2, 99 73 65 64 63 bytes

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

Try it online!

Alternatives also with 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]

TFeld

Posted 2018-03-05T11:13:17.053

Reputation: 19 246

24Upvoted because of using python to solve a monty python challenge. – Brain Guider – 2018-03-05T12:34:43.297

10@AnderBiguri, please cast your vote based on the solution itself rather than the language used. – Shaggy – 2018-03-05T12:51:07.410

26@Shaggy AFAIK the choice of language is one of the fun parts of PPCG! I like the solution, because its in python. We already have the bytes to see which one "wins" – Brain Guider – 2018-03-05T14:29:50.380

1@AnderBiguri We already have the “bites” to see which one wins!! ;) – NL628 – 2018-03-05T15:34:11.863

2Yes, votes in codegolf should be merely for the approach considered best or most creative as the winner is determined otherwise. Also it would be boring if everyone just used special codegolf languages instead of getting creative with more common ones – Gimli – 2018-03-06T18:07:02.910

5I agree, there can be many reasons to like a particular answer. But even if people are so excited by "Python for Monty Python" pun, it is still sad to see that upvoters don't bother to scroll down a bit, and show some appreciation to another Python answer that is actually more unconventional and even a tad shorter... – Kirill L. – 2018-03-07T07:40:26.883

17

Python 2, 62 bytes

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

Try it online!

How?

This submission uses the fact that the hash function is stable for strings in Python 2. Each valid input has a valid output. The brute-forced repeated modulo %97%78%28%15%2 returns 1 for all tinny and PVC words and 0 for woody words. By adding the value of ('ea' in n) to it, we get 2 instead of 1 for the input 'leap'. Here is a table of all values:

+----------------+----------------------+----------------+-------------+-------+
| 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 |
+----------------+----------------------+----------------+-------------+-------+

The type to return is now extracted from the string 'wtPoiVonCdn yy' by taking every third character, starting at the calculated index.

ovs

Posted 2018-03-05T11:13:17.053

Reputation: 21 408

12

JavaScript (ES6), Chrome/Edge, 54 bytes

Because the behavior of parseInt() on large inputs with a radix of 36 is implementation-dependent, this one doesn't work with SpiderMonkey (Firefox).

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

Try it online!

How?

The hash function returns 3 for Tinny words, 1 for PVC and either 0, 4, 5 or 6 for Woody words. The words marked with an asterisk are implicitly truncated because space is considered as an invalid character by parseInt().

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

Previous version, 59 57 bytes

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

Try it online!

How?

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

Arnauld

Posted 2018-03-05T11:13:17.053

Reputation: 111 334

9

Retina, 39 38 36 bytes

Saved 1 byte by using three substitution pairs as in Adám's answer.

L#-3$0`ea
PVC
.p.|is?t
tinny
$
woody

Try it online!

I got the .p.|is*t regex from Peter Norvig's regex golfer.

Martin Ender

Posted 2018-03-05T11:13:17.053

Reputation: 184 808

2Uh oh, circular attributions. – Adám – 2018-03-05T12:24:30.077

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.

Kevin Cruijssen

Posted 2018-03-05T11:13:17.053

Reputation: 67 575

2It's really cool to be able to read through this problem-solving kind of thinking :) – AJFaraday – 2018-03-05T13:12:11.873

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.

xnor

Posted 2018-03-05T11:13:17.053

Reputation: 115 687

1Nice! You can save a byte by detecting "leap" with |a=='l'="PVC". – Lynn – 2018-03-05T22:57:27.293

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!

Adám

Posted 2018-03-05T11:13:17.053

Reputation: 37 779

5

C (gcc), 81 80 79 bytes

-1 byte thanks to @ceilingcat.

h;f(char*s){puts(index("HzYfPW",h=*s^s[1]*4&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.

gastropner

Posted 2018-03-05T11:13:17.053

Reputation: 3 264

@ceilingcat Oof, keep forgetting those POSIX extras. Cheers! – gastropner – 2020-01-06T18:24:13.997

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;

anatolyg

Posted 2018-03-05T11:13:17.053

Reputation: 10 719

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"

Jonathan Allan

Posted 2018-03-05T11:13:17.053

Reputation: 67 804

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.

totallyhuman

Posted 2018-03-05T11:13:17.053

Reputation: 15 378

f"leap"="PVC";f s| is shorter than f s|s=="leap"="PVC"|. – Laikoni – 2018-03-05T12:50:28.927

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

Οurous

Posted 2018-03-05T11:13:17.053

Reputation: 7 916

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. :)

lee

Posted 2018-03-05T11:13:17.053

Reputation: 200

1You 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 – 2018-03-06T08:37:19.587

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 – 2018-03-06T10:49:02.247

2string 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 – 2018-03-07T11:17:42.253

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]

Jonathan Allan

Posted 2018-03-05T11:13:17.053

Reputation: 67 804

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!

Steadybox

Posted 2018-03-05T11:13:17.053

Reputation: 15 798

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.

Neil

Posted 2018-03-05T11:13:17.053

Reputation: 95 035

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.

Martin Ender

Posted 2018-03-05T11:13:17.053

Reputation: 184 808

1

Japt, 36 34 bytes

Uses a RegEx from Martin's Retina solution.

g2 ¶'a?"PVC":`wÅnyy`ë2Uè`?t|.pe

Try it | Check all test cases

Shaggy

Posted 2018-03-05T11:13:17.053

Reputation: 24 623

1

Excel, 81 bytes

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

Using the 'anetisilire' method.

Wernisch

Posted 2018-03-05T11:13:17.053

Reputation: 2 534

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"));

vityavv

Posted 2018-03-05T11:13:17.053

Reputation: 734