Identify the Eeveelutions

Python 2, 77 76 bytes

lambda s:'VFULJSGEalmeoylspaballaporrftvc'[hash(s)%3695%8::8]+'reon'[s<'V':]

Try it online!

In Python 2, the hash function consistently (across runs and also on different platforms) converts any immutable value into a 64-bit integer. By taking that integer first mod 3695, then mod 8, we get an integer 0<=i<8 (3695 was found by brute force checking all possible values upto 10000).

A common trick is used to encode a list of same-size strings into a single string and then using slicing via [i::8]to extract the strings without using .split or similar strategy. Only two options are not of length 4: Esp and Vapor. The former is handled by making it the last of the 8 strings encoded; and Vapor is handled using the final slicing 'reon'[s<'V':].


Perl 6, 72 67 65 64 bytes

{<Sylv Esp Glac Jolt Leaf Umbr Flar Vapor>[:36($_)%537%8]~'eon'}

Try it online!

A golf to all unique indexes by parsing the string as base 36 and moduloing it. I've left a version that just uses the sum below so other answer that may not have the same short base converting code that Perl 6/Raku does. There is also base 35 with modulo 51 and 10, but that comes out to the same byte count.

Perl 6, 67 bytes

{<Leaf Esp Umbr Vapor 0 Sylv Flar Jolt Glac>[.ords.sum%64%9]~'eon'}

Try it online!

Differentiates between inputs by the sum of the ordinal values, modulo 64 modulo 9, leaving one extra spot to be filled in. Unfortunately, my brute force script couldn't find any pairs of moduli that led to no empty spaces, and adding a third would cost more than it gained.


Ruby -p, 89 67 bytes

Direct port of Jo King's Perl answer. By sheer coincidence, the byte count is even the same. The byte counts are no longer the same as Jo King has switched to using a technique that cannot be tersely replicated in Ruby.

$_=%w"Leaf Esp Umbr Vapor 0 Sylv Flar Jolt Glac"[$_.sum%64%9]+'eon'

Try it online!

Original Version, Ruby -p, 89 bytes

Basic lookup checking the first letter of the input (or first 2 if the second letter is i, which is only present in Fire).

$_=%w"WVapor EJolt PEsp DUmbr GLeaf IGlac FSylv FiFlar".find{|e|e.sub!$_[/.i?/],''}+'eon'

Try it online!