42
\$\begingroup\$

It's super effective!

In Pokémon there are 18 types:

Normal    Fighting  Flying  Poison  Ground  Rock
Bug       Ghost     Steel   Fire    Water   Grass
Electric  Psychic   Ice     Dragon  Dark    Fairy

A Pokémon can have single or dual typing. For example, Pikachu is Electric, and Tyranitar is Rock/Dark. The order of the types does not matter. A Pokémon can't have the same type twice. An attacking move has exactly one of the above 18 types.

  • Some Pokémon types are weak to a certain type of attack. For example, a Fire Pokémon is weak against Water attacks. This gives a damage multiplier of 2.

  • Some Pokémon types are resistant to a certain type of attack. For example, a Rock Pokémon is resistant against a Normal attack. This gives a damage multiplier of 0.5.

  • Some Pokémon types are immune to a certain type of attack. For example, a Flying Pokémon is immune against a Ground attack. This gives a damage multiplier of 0.

A pokemon can be doubly weak, doubly resistant or any other combination against an attacking type. Multiply the multipliers to get a total effectiveness.

Write a program or function that given a move type and a Pokémon typing outputs the total damage multiplier of the attack. A Pokémon typing is always written either as A or A/B, where A and B are distinct types from the list above. You must accept the Pokémon typing in this format. Other than this restriction you may take input in any reasonable manner. An example input format that acceptable is:

"Ice", "Dragon/Flying"

But this is unacceptable:

["Ice", ["Dragon", "Flying"]]

Your output must be exactly one of the following strings, followed by an optional trailing newline:

0x    0.25x    0.5x    1x    2x    4x

Examples

Ground, Fire -> 2x
Normal, Rock/Dragon -> 0.5x
Fighting, Ghost/Steel -> 0x
Steel, Water/Steel -> 0.25x
Ice, Dragon/Flying -> 4x
Water, Ground/Water -> 1x
Ghost, Ghost -> 2x

Type effectiveness

For a human-friendly type chart I'd like to refer you to Gamepedia. To make the golfing process a bit faster I'll give you a compressed computer-friendly matrix of effectiveness. Divide every number by two to get the true multiplier (1 -> 0.5, 4 -> 2):

              Defending type
               (same order)

   Normal   222221201222222222
   Fighting 421124104222214241
A  Flying   242221421224122222
t  Poison   222111210224222224
t  Ground   220424124421422222
a  Rock     214212421422224222
c  Bug      211122211124242241
k  Ghost    022222242222242212
i  Steel    222224221112124224
n  Fire     222221424114224122
g  Water    222244222411222122
   Grass    221144121141222122
T  Electric 224202222241122122
y  Psychic  242422221222212202
p  Ice      224242221114221422
e  Dragon   222222221222222420
   Dark     212222242222242211
   Fairy    242122221122222442

Shortest code in bytes wins.

\$\endgroup\$
  • 4
    \$\begingroup\$ I love video-game-based challenges! \$\endgroup\$ – kirbyfan64sos Sep 1 '15 at 15:44
  • 7
    \$\begingroup\$ I prefer to pretend that the Fairy type doesn't exist. Pokemon is only getting worse the more they add. \$\endgroup\$ – mbomb007 Sep 1 '15 at 15:46
  • 34
    \$\begingroup\$ PPCG used CJam! It's super effective! PPCG used Java! It's not very effective... \$\endgroup\$ – Fatalize Sep 1 '15 at 15:47
  • 10
    \$\begingroup\$ Don't listen to mean ol' mbomb007, little Togekiss. Everyone knows you're better with Fairy typing. \$\endgroup\$ – Geobits Sep 1 '15 at 16:11
  • 4
    \$\begingroup\$ Someone should write an answer in Pikalang! (Good luck.) \$\endgroup\$ – mbomb007 Sep 1 '15 at 21:49
16
\$\begingroup\$

Pyth - 246 245 188 bytes

Encodes the matrix with base compression, will probably use modular indexing/hashing for the matrix indices but right now I haven't done anything fancy with those.

Lxc"NorFigFlyPoiGroRocBugGhoSteFirWatGraElePsyIceDraDarFai"3<b3.F"{:g}x"*Fm@@c19cR2KXjC"
©ªªå´ê۩涪©Y+ªº;oªnz®©Z»­*«ªºj«¥fëª×­ª¯«Z¥ö]©ªâªÖ»ªj*î¥zzªªj«ªº«¥¹ªZ«ë¥ª¾"4]3]4yzydcw\/

Test Suite.

\$\endgroup\$
  • 10
    \$\begingroup\$ Are you sure that's a program and not line noise? \$\endgroup\$ – Mark Sep 3 '15 at 1:34
17
\$\begingroup\$

Java, 663 639 582 bytes

String f(String...a){float d=1;for(String B:a[1].split("/"))d*=("222221201222222222421124104222214241242221421224122222222111210224222224220424124421422222214212421422224222211122211124242241022222242222242212222224221112124224222221424114224122222244222411222122221144121141222122224202222241122122242422221222212202224242221114221422222222221222222420212222242222242211242122221122222442".charAt(g(a[0])*18+g(B))-48)*.5;return(d+"x").replace(".0","");}int g(String a){int i=0;for(;i<18;i++)if(a.contains("N,gh,ly,oi,ou,ck,B,ho,S,re,W,G,E,P,I,g,k,y".split(",")[i]))break;return i;}

There's a simple lookup table that takes much of the room. It just finds the correct types and multiplies it out. Call it like this:

f("Water","Ground/Fire")

With some line breaks it looks like this:

String f(String...a){
    float d=1;
    for(String B:a[1].split("/"))
        d*=("222221201222222222421124104222214241242221421224122222222111210224222224220424124421422222214212421422224222211122211124242241022222242222242212222224221112124224222221424114224122222244222411222122221144121141222122224202222241122122242422221222212202224242221114221422222222221222222420212222242222242211242122221122222442"
                .charAt(g(a[0])*18+g(B))-48)*.5;
    return(d+"x").replace(".0","");
}

int g(String a){
    int i=0;
    for(;i<18;i++)
        if(a.contains("N,gh,ly,oi,ou,ck,B,ho,S,re,W,G,E,P,I,g,k,y".split(",")[i]))
            break;
    return i;
}
\$\endgroup\$
  • 1
    \$\begingroup\$ You can shave a few bytes by using c="222...442".split(","); \$\endgroup\$ – Ypnypn Sep 1 '15 at 16:39
  • \$\begingroup\$ Right. Not sure why I did it for one and not the other :/ \$\endgroup\$ – Geobits Sep 1 '15 at 16:40
  • \$\begingroup\$ you wanna explain this to us? I'm very interested but don't understand what's happening lol :) \$\endgroup\$ – duxfox-- Sep 1 '15 at 21:12
  • 2
    \$\begingroup\$ Could you shave bytes using for(String B:b) making your for-loop go from 24 to 15, saving 9, and making your [b[i++]] into B for 7 more savings. Total of 16 savings! \$\endgroup\$ – corsiKa Sep 2 '15 at 17:52
  • 1
    \$\begingroup\$ @Luminous I'm not sure about that. Since I return i, I'd need to either subtract one later or start it at -1, either of which would negate that saved byte. \$\endgroup\$ – Geobits Sep 3 '15 at 14:00
9
\$\begingroup\$

JavaScript (ES6), 287

I haven't seen a good compression of the types, so here's one.

(a,b)=>b.split('/').reduce((j,p)=>j*[0,.5,1,2][parseInt("kjwhcgnj2xd6elihtlneemw82duxijsazl3sh4iz5akjmlmsqds06xf1sbb8d0rl1nu7a2kjwi3mykjwlbpmk1up4mzl1iuenedor0bdmkjwmpk6rhcg4h3en3pew5".substr((g=x=>[..."BWSEIRNulkcDPotyeG"].findIndex(c=>x.match(c)))(a)*7,7),36).toString(4)[g(p)]],1)+'x'

Ungolfed:

(a,b)=>{
  // keys is a list of letters found in the types of attacks/defenses
  keys = [..."BWSEIRNulkcDPotyeG"]; 

  // getIndex is a single case statement.
  // it checks each of keys, one-by-one, falling through until we've found the proper index
  getIndex=x=>keys.findIndex(c=>x.match(c));

  // encodedValues is a list, indexed by `keys`, where each value is 7-characters.
  encodedValues = "kjwhcgnj2xd6elihtlneemw82duxijsazl3sh4iz5akjmlmsqds06xf1sbb8d0rl1nu7a2kjwi3mykjwlbpmk1up4mzl1iuenedor0bdmkjwmpk6rhcg4h3en3pew5";

  // the 7-character value (e.g., B=0="kjwhcgn", W=1="j2xd6el") were created by 
  // turning base4 values into base36, so let's turn this back into a string the same way
  valuesForAttack = parseInt(encodedValues.substr(getIndex(a)*7,7),36).toString(4);

  // valuesForAttack is indexed by defenseType.  The value will be 0..3, depending on the multiplier

  // let's get an array of the multipliers and reduce...
  multiplier = b.split('/').reduce((oldMultiplier,defenseType)=>oldMultiplier * [0,.5,1,2][valuesForAttack[getIndex(defenseType)]],1);

  return multiplier+'x';
}

Oh, and here's my chart (keeping in mind it's ordered so that a letter won't match any words listed below it):

"Bug" => "B",
"Water" => "W",
"Steel" => "S",
"Electric" => "E",
"Ice" => "I",
"Rock" => "R",
"Normal" => "N",
"Ground" => "u",
"Flying" => "l",
"Dark" => "k",
"Psychic" => "c",
"Dragon" => "D",
"Poison" => "P",
"Ghost" => "o",
"Fighting" => "t",
"Fairy" => "y",
"Fire" => "e",
"Grass" => "G"
\$\endgroup\$
  • \$\begingroup\$ Good job! I had a similar idea, but you got to it first! \$\endgroup\$ – MayorMonty Sep 2 '15 at 2:23
  • 1
    \$\begingroup\$ If you encode your already encoded values string with atob, you can save 26 bytes by using btoa on that. When you encode it just make sure to add an extra character since "...pew5" becomes "...peww==" due to byte alignment. \$\endgroup\$ – SLuck49 Sep 2 '15 at 12:59
  • \$\begingroup\$ @SLuck49 Thanks. I tried it and it seems like it's fewer characters but more bytes. Am I doing something wrong? \$\endgroup\$ – Not that Charles Sep 2 '15 at 13:54
  • \$\begingroup\$ Shoot you're right, I was looking at character count instead of byte count... stupid UTF-8 multi byte characters. \$\endgroup\$ – SLuck49 Sep 2 '15 at 14:12
  • \$\begingroup\$ @SLuck49 It's likely that there's a better way to encode the multipliers. There's a lot of wasted space with all the 2's. \$\endgroup\$ – Not that Charles Sep 2 '15 at 14:48
9
\$\begingroup\$

Pikalang, 868068 bytes

This was just too good of an idea to skip. (Thanks, mbomb007.)

It's basically a sub-optimal lookup table. I first encode each type as

((first_char + second_char * 2 + third_char * 3) mod 256) - 0x3c

This results in unique representations for each type. The empty type (when the defending pokemon has only a single type) is encoded as 0x00.

After that I just use a mess of if-else equivalents to check all the ~5800 combinations.

Code

Stack Exchange didn't allow me to post the code as a whole, so here's it gzipped + base64'd.

H4sICBA56FUAC3N1cGVyZWZmZWN0aXZlLWdvbGZlZC5wb2tlYmFsbADt2MGOHcdyreG5Ab+DXu3AEws90cTvb1utRrEOuzf3bmZV/mvFD+jyHotkxReRkclF/fXn27/++vOPv/78+4d//vfbv/74v3/++vO//vt//vj7X7z//Pv/+eDX/PjLfv7nx9/x/r+/+uf8mb//xd9VH/+u99/wYx/Qnt47+aexj//j/ad+4Pzqc49//op/DvE/P/zE/jiGj//34y8+T/b99x+/+3QOq8/tR95B/7mF0wb98RP4/NM/9vtT6d9ekMdfPX/7i5/++jd+9c+j37bkX29W3VU+9Gs/7tyeH//9zTj98Mm6//Xnv92fr3/L17/u03/z1b+kTOqH9/+zPwoe/vFwvByf//+v/Mnz6+KPfsVPP/c14dcffe1TPw7TOf7K6bRemdajOX7xuD3/w/vX/jmIz7LCmjLPIvIhTb0IKYdQXRiIrpvqOVkh97jezv8BxeT5xG/46WeWnpfLLETILAimF11ChAi5E2JANa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hv1zKffLPvapz5G6hx/d44L9//jewMuvRAhQnTpEjK6cSHLIW/+BQERbJ84yIBtSoA09SJEiNHizh/aD8S5C1npMn2aPms2XYiQSZCmXoSUQ6guISEQo6pRtXS1hXBdYyFjGxeyu16cawGkqZcyyEOXsdRYWrPpYyHWKz1YIULqXBgI1TUWcq5nNjWbpm0wH6JrZD0hu+vxIR6IEAZkbz2DZ0LwPM6sfR83XnyqCwPJXxTMKANnlwlprxfnaj+QvfWMcwlx7vWzHXRh+RCqS8huiI1PaxwDaa8nZHe9JyFG0OgIehwmZqO+BYHeDiGDIZjGnQPb1QRp6kXIHRATpAlyxqZfDxnbeJxLiJAYyGZXez0h6RAz7KYMexwDZheECBHCg2Aadw5CslxCUlxniLF0UyxdfZjXb9TdG4y5MboQ9aguzByECNElZCTEIGuQnbHp10Pa68W5MBCqCwOhusZCbHxa43zIQ5dBNjrIfnm21H3zQgoRIsR60w5WSB6E6jpDzLDRGfY4TF9fr/h4yNjGhQgRQq8n5JsQU6optXS1B0Ha6wkRIoReDwPBNK5rocuoalSt2XQhQnRlQ9rrCdld70pIUy9XQIybxs3S1RYCgugSImSGCwOhuoTshpzr/Xvd4xf9/w/v9d85//kf/wsHs6nq5j4NAA==

Example

Apparently the official Pikalang interpreter is not ready yet, but since it's a trivial Brainfuck substitution, I tested it using a Brainfuck interpreter.

$ base64 -d supereff.pokeball.gz.b64 > supereff.pokeball.gz
$ gunzip supereff.pokeball.gz
$ pikalang supereff.pokeball
Normal
Rock/Dragon
0.5x

Input is newline-separated and requires an additional trailing newline.

The program uses the memory location -1, so if your interpreter disallows going off the left side of the tape, prepend the code with a pipi or a > (for Pikalang and Brainfuck, respectively).

Brainfuck, 193708

Here's the same program in Brainfuck (also gzipped + base64'd).

H4sICGI+6FUAC3N1cGVyZWZmZWN0aXZlLWdvbGZlZC5iZgDtXQt2GzkOPJDjOYEeL6Ln+19jbHmsyKNPgwSqUCDpfTuTqBokgC4WAEab/dP+nN9Pb2/t4/vfn794u/x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8IB4N/P60qlKM0gdxCodYG0K8+vKNCLhzbZMGnFefayKC9EMiCuVJoG8a1kXlCOBJJHBeH5hCTz4mn98EAgo+uSIsli1xNi8VPVby+in6ieS587N/sL9rrUNgviqYi8Vil8em0K286E81ryUmTyBASreK71cefhxSNK7pK5lnDbkNLdp6gaqstyR6QmZgo1pce+4slI8VyRbO6AEAOVF08xFpwRVEdKbNQ5tAo9I0nsXqGKugIFGyseCh1ZU2QZMNR5+PcCT5lELMEsQjR/sgKWiG4vOWka1zASt5b+iqNoCwnxLDdLdSVSjl3UdkBMXduuuxhQwAWJbVdjF2RlJeHrXHTrVgAYWkzkwDzjhe48HDiPZfzLDu5ZzeDUEzrx+1D7pjzuULNQhTE3+6upfT4z4ldMCLhCbVNqUyClJ9LTPdkFRFVJ03AOi7RRV5BIsYTrghmETPHcWIzVxAtSRQDrKhE6BJ9Dve42Tx9gXJslG4sPE7e46oyIC1wJrNJHLVEqY6JVOd9K4Go1Ml8oaoHUcaQHX4RdTtCL55O+x2jrVQjoxRV9FgvowrdPpJ3/aR//ArQnatCs9AIA

The program contains four parts:

  1. The input. Reading the types and calculating their identifiers.
  2. The text generation. Generating strings for each of the possible outputs.
  3. The lookup table. This part was computer-generated (see below). Moves the pointer to the correct result.
  4. The output. Just printing the result.

Main program structure

,>,[-<++>],[-<+++>] read first type id
++++++[-<---------->] subtract 3c
+[,----------] skip until newline
>,>,[-<++>],[-<+++>] read second type id
++++++[-<---------->] subtract 3c
>- set @LOOPFLAG@ to get into loop
[
 >-< set @CHARFLAG@
 <,---------- get character; newline is 00 slash is 25
 [ was not newline
  ------------------------------------- slash is now 00
  [ was not slash
   >>+<< reset @CHARFLAG@
   [-] clear character
  ]
 ]
 >>[ was newline or slash (@CHARFLAG@ set)
  <+>+ reset @LOOPFLAG@ and @CHARFLAG@
 ]<
]
,>,[-<++>],[-<+++>] read third type id
<[->+>+<<]>[-<+>] copy third to @CHARFLAG@
>[ if @CHARFLAG@ is set
 [-] clear @CHARFLAG@
 <++++++[-<---------->]> subtract 3c from third
]<
++++++++[- do 8 times
 >++++++ put a 0 here
 >+++++++++++++++ put an x here
 >>++++++ put a 0 here
 >++++++ put a 0 here
 >++++++ put a 0 here
 >+++++++ put a 8 here
 >+++++++++++++++ put an x here
 >>++++++ put a 0 here
 >++++++ put a 0 here
 >+++++++ put a 8 here
 >+++++++++++++++ put an x here
 >>++++++ put a 0 here
 >+++++++++++++++ put an x here
 >>++++++ put a 0 here
 >+++++++++++++++ put an x here
 >>++++++ put a 0 here
 >+++++++++++++++ put an x here
 <<<<<<<<<<<<<<<<<<<<<< go back
]
>>>>>-- change 0 to dot
>++ change 0 to 2
>--- change 8 to 5
>>>>-- change 0 to dot
>--- change 8 to 5
>>>+ change 0 to 1
>>>++ change 0 to 2
>>>++++ change 0 to 4
<<<<<<<<<<<<<<<<<<<<<< go back
(lookup table here)
>[.>] print result

Here's the script that generates the lookup table:

typemap = [[int(value, 16), name] for value, name in [
    ["00", "(Nothing)"],
    ["02", "Ice"],
    ["07", "Fairy"],
    ["0f", "Dragon"],
    ["10", "Electric"],
    ["11", "Fighting"],
    ["12", "Grass"],
    ["1d", "Rock"],
    ["20", "Dark"],
    ["25", "Bug"],
    ["28", "Ghost"],
    ["2d", "Poison"],
    ["2e", "Steel"],
    ["32", "Fire"],
    ["39", "Water"],
    ["3c", "Ground"],
    ["46", "Normal"],
    ["4d", "Flying"],
    ["65", "Psychic"]
]]
multipliers = {
    0: 5,
    0.25: 8,
    0.5: 14,
    1: 19,
    2: 22,
    4: 25
}
types = [
    "Normal", "Fighting", "Flying", "Poison", "Ground", "Rock", "Bug", "Ghost", "Steel",
    "Fire", "Water", "Grass", "Electric", "Psychic", "Ice", "Dragon", "Dark", "Fairy"
]
results = [
    [2, 2, 2, 2, 2, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2],
    [4, 2, 1, 1, 2, 4, 1, 0, 4, 2, 2, 2, 2, 1, 4, 2, 4, 1],
    [2, 4, 2, 2, 2, 1, 4, 2, 1, 2, 2, 4, 1, 2, 2, 2, 2, 2],
    [2, 2, 2, 1, 1, 1, 2, 1, 0, 2, 2, 4, 2, 2, 2, 2, 2, 4],
    [2, 2, 0, 4, 2, 4, 1, 2, 4, 4, 2, 1, 4, 2, 2, 2, 2, 2],
    [2, 1, 4, 2, 1, 2, 4, 2, 1, 4, 2, 2, 2, 2, 4, 2, 2, 2],
    [2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 4, 2, 4, 2, 2, 4, 1],
    [0, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 4, 2, 2, 1, 2],
    [2, 2, 2, 2, 2, 4, 2, 2, 1, 1, 1, 2, 1, 2, 4, 2, 2, 4],
    [2, 2, 2, 2, 2, 1, 4, 2, 4, 1, 1, 4, 2, 2, 4, 1, 2, 2],
    [2, 2, 2, 2, 4, 4, 2, 2, 2, 4, 1, 1, 2, 2, 2, 1, 2, 2],
    [2, 2, 1, 1, 4, 4, 1, 2, 1, 1, 4, 1, 2, 2, 2, 1, 2, 2],
    [2, 2, 4, 2, 0, 2, 2, 2, 2, 2, 4, 1, 1, 2, 2, 1, 2, 2],
    [2, 4, 2, 4, 2, 2, 2, 2, 1, 2, 2, 2, 2, 1, 2, 2, 0, 2],
    [2, 2, 4, 2, 4, 2, 2, 2, 1, 1, 1, 4, 2, 2, 1, 4, 2, 2],
    [2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 4, 2, 0],
    [2, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 4, 2, 2, 1, 1],
    [2, 4, 2, 1, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 4, 4, 2]
]
def getMultiplier(first, second, third):
    id1 = types.index(first)
    id2 = types.index(second)
    if third in types:
        id3 = types.index(third)
        return results[id1][id2] * results[id1][id3] / 4;
    else:
        return results[id1][id2] / 2

def genFirstType(second, third, remain, removed):
    mul = getMultiplier(remain[0][1], second, third)
    if len(remain) == 1:
        result = "[ first is not " + removed[1] + "\n"
        result += "thus first must be " + remain[0][1] + "\n"
        result += ">" * (multipliers[mul] - 1) + "[-]-> " + str(mul).replace(".", "").rstrip("0") + "x multiplier\n"
        result += "]\n"
        return result
    elif not removed:
        result = "<<" + "-" * remain[0][0] + " " + remain[0][1] + " is now 00\n"
        result += genFirstType(second, third, remain[1:], remain[0])
        result += "<+[ first is " + remain[0][1] + "\n"
        result += ">" * multipliers[mul] + "[-] " + str(mul).replace(".", "").rstrip("0") + "x multiplier\n"
        result += "]->\n"
        return result
    else:
        result = "[ first is not " + removed[1] + "\n"
        result += "-" * (remain[0][0] - removed[0]) + " " + remain[0][1] + " is now 00\n"
        result += genFirstType(second, third, remain[1:], remain[0])
        result += "<+[ first is " + remain[0][1] + "\n"
        result += ">" * multipliers[mul] + "[-] " + str(mul).replace(".", "").rstrip("0") + "x multiplier\n"
        result += "]->\n"
        result += "]\n"
        return result
def genSecondType(third, remain, removed):
    if len(remain) == 1:
        result = "[ second is not " + removed[1] + "\n"
        result += "thus second must be " + remain[0][1] + "\n"
        result += genFirstType(remain[0][1], third, typemap[1:], False)
        result += "]\n"
        return result
    elif not removed:
        result = "<<" + "-" * remain[0][0] + " " + remain[0][1] + " is now 00\n"
        result += genSecondType(third, remain[1:], remain[0])
        result += "<+[-> second is " + remain[0][1] + "\n"
        result += genFirstType(remain[0][1], third, typemap[1:], False)
        result += "<+]->\n"
        return result
    else:
        result = "[ second is not " + removed[1] + "\n"
        result += "-" * (remain[0][0] - removed[0]) + " " + remain[0][1] + " is now 00\n"
        result += genSecondType(third, remain[1:], remain[0])
        result += "<+[-> second is " + remain[0][1] + "\n"
        result += genFirstType(remain[0][1], third, typemap[1:], False)
        result += "<+]->\n"
        result += "]\n"
        return result
def genThirdType(remain, removed):
    if len(remain) == 1:
        result = "[ third is not " + removed[1] + "\n"
        result += "thus third must be " + remain[0][1] + "\n"
        result += genSecondType(remain[0][1], [item for item in typemap[1:] if item[1] != remain[0][1]], False)
        result += "]\n"
        return result
    elif not removed:
        result = "-" * remain[0][0] + " " + remain[0][1] + " is now 00\n"
        result += genThirdType(remain[1:], remain[0])
        result += "<+[-> third is " + remain[0][1] + "\n"
        result += genSecondType(remain[0][1], [item for item in typemap[1:] if item[1] != remain[0][1]], False)
        result += "<+]->\n"
        return result
    else:
        result = "[ third is not " + removed[1] + "\n"
        result += "-" * (remain[0][0] - removed[0]) + " " + remain[0][1] + " is now 00\n"
        result += genThirdType(remain[1:], remain[0])
        result += "<+[-> third is " + remain[0][1] + "\n"
        result += genSecondType(remain[0][1], [item for item in typemap[1:] if item[1] != remain[0][1]], False)
        result += "<+]->\n"
        result += "]\n"
        return result
def genLookup():
    return genThirdType(typemap, False)

def compact(code):
    import re
    return re.sub(r"[^+\-<>\[\],.]", "", code)
def golfStep(code):
    return code.replace("><", "").replace("<>", "").replace("+-", "").replace("-+", "")
def golf(code):
    previous = golfStep(code)
    while previous != code:
        previous, code = code, golfStep(code)
    return code

if __name__ == "__main__":
    import sys
    result = genLookup()
    if "-g" in sys.argv:
        print(golf(compact(result)))
    elif "-c" in sys.argv:
        print(compact(result))
    else:
        print(result)

BTW, this answer takes 29817 bytes. :)

\$\endgroup\$
  • \$\begingroup\$ Really, the interpreter isn't ready? What about here? \$\endgroup\$ – mbomb007 Sep 3 '15 at 13:52
  • \$\begingroup\$ @mbomb007 Well, at least the one you linked earlier wasn't. I'm not sure about that one (BFC), it doesn't list Pikalang on the front page and I'm also not sure if it works (depends on it parsing spaces correctly, PIPI could be interpreted as > or ++). Also BFC would apparently require upper-casing the code. \$\endgroup\$ – PurkkaKoodari Sep 3 '15 at 14:57
  • \$\begingroup\$ Thank you @Pietu1998 for making the pikalang version. hilarious! now if i could find the time to finish this language how i want instead of the quick and dirty way. Thanks again \$\endgroup\$ – groteworld Aug 8 '17 at 7:04
5
\$\begingroup\$

C++14, 420 416

#include<iostream>
#include<string>
std::string m,t,n="NorFigFlyPoiGroRocBugGhoSteFirWatGraElePsyIceDraDarFai";int i;int main(){std::cin>>m>>t;auto k=[](auto y){return(i=6*n.find(m.substr(0,3))+n.find(y.substr(0,3))/3,i="J:2JJJ;YQJV>N:;ZIJJ5&ZJZ*[Y;KJVF;KZJ6I6YN>HJNJNFJZ:EYZJ:[UZIJ^J7JI:]9=JIZBJ>IINK:JFBZN:U:KJJ:JJ+FJNJN6NI:IJO"[i/3]-32>>i%3*2&3,i+i/3)/2.;};std::cout<<k(t)*((i=t.find(47)+1)?k(t.substr(i)):1)<<"x";}

Input should be to stdin and be in the form Normal, Rock/Dragon

Live version.

With some whitespace:

#include<iostream>
#include<string>
std::string m, t, n = "NorFigFlyPoiGroRocBugGhoSteFirWatGraElePsyIceDraDarFai";
int i;
int main(){
    std::cin >> m >> t;
    auto k = [](auto y){
        return(i = 6 * n.find(m.substr(0, 3)) + n.find(y.substr(0, 3)) / 3
            , i = "J:2JJJ;YQJV>N:;ZIJJ5&ZJZ*[Y;KJVF;KZJ6I6YN>HJNJNFJZ:EYZJ:[UZI"
            "J^J7JI:]9=JIZBJ>IINK:JFBZN:U:KJJ:JJ+FJNJN6NI:IJO"[i / 3] - 32 >> i % 3 * 2 & 3
            , i + i / 3) / 2.;
    }; 
    std::cout << k(t)*((i = t.find(47) + 1) ? k(t.substr(i)) : 1) << "x";
}
\$\endgroup\$
3
\$\begingroup\$

Tcl, 382

proc p a\ d [zlib i ...361 bytes...]

The script contains compressed data including non-UTF-8 bytes. Here is the exact script encoded in base 64:

cHJvYyBwIGFcIGQgW3psaWIgaSDFU7FugzAQ/ZU3pEuGlljqwlilibpUUVw7dEBc
Zo7jghUHI9uREiH+vUDA2NCqY2SJXDt87969XDvb5dkaXCTfSp+oxUN2QWKZjOPm
L1dlHC9RLetEnmiJPRJTSmGxOOApRSVFceAXVNVcbsOKHp/bb28nq0ZFeswtTm4+
SJBPhkiDX7nYEBmYSVijw6489l5Jx3/Dj0pIj47GWp0lXh2fN6w9R5FcdHasP1dE
HH7oMVxupkRmfpfn+lx298NOHXOADmbqKXcT9NDE1Se/dDFiRybiT7rb+Sunm1xb
0J1fwceOM/JcIoEfBaz+HVx0XHt0XjCROa/T587wvxPx7+dU4TS/wdQ1Emk41SxH
9d4+NomNyHIrilxmG3ltzU5cdKNcbmy1OhcHfCh2xMs5wzZXxuLTct6maI4varlu
YNQYvErOrBZcZlw7c2V5Y98Yx1rTrCFaU1x9xIZcblx9rbGg6Z0F7NM6TdMfXQ== 

Uses the zlib command for compression.

\$\endgroup\$
  • \$\begingroup\$ That's not really a valid tcl script now is it? \$\endgroup\$ – slebetman Sep 2 '15 at 4:36
  • 1
    \$\begingroup\$ @slebetman It's the tcl script encoded in base64. \$\endgroup\$ – orlp Sep 2 '15 at 6:01
  • 2
    \$\begingroup\$ wanna explain what it does? \$\endgroup\$ – Not that Charles Sep 2 '15 at 19:54
3
\$\begingroup\$

Lua, 758 661 633 bytes

m={"222221201222222222","421124104222214241","242221421224122222","222111210224222224","220424124421422222","214212421422224222","211122211124242241","022222242222242212","222224221112124224","222221424114224122","222244222411222122","221144121141222122","224202222241122122","242422221222212202","224242221114221422","222222221222222420","212222242222242211","242122221122222442"}s="NorFigFlyPoiGroRocBugGhoSteFirWatGraElePsyIceDraDarFai"function f(a,d)z=string.sub n=tonumber _,r=s:find(z(a,1,3))r=r/3g,_,c=0,s:find(z(d,1,3))c=c/3p=d:find("/")or 0 e=m[r]_,g=s:find(z(d,p+1,p+3))g=g/3r=n(z(e,c,c))/2r=r*n(z(e,g,g))/2print(r.."x")end

Ungolfed:

m={"222221201222222222","421124104222214241","242221421224122222","222111210224222224","220424124421422222","214212421422224222","211122211124242241","022222242222242212","222224221112124224","222221424114224122","222244222411222122","221144121141222122","224202222241122122","242422221222212202","224242221114221422","222222221222222420","212222242222242211","242122221122222442"}
s="NorFigFlyPoiGroRocBugGhoSteFirWatGraElePsyIceDraDarFai"
function f(a,d)
    z=string.sub
    n=tonumber
    _,r=s:find(z(a,1,3))
    r=r/3
    g,_,c=0,s:find(z(d,1,3))
    c=c/3
    p=d:find("/") or 0
    e=m[r]
    _,g=s:find(z(d,p+1,p+3))
    g=g/3
    r=n(z(e,c,c))/2
    r=r*n(z(e,g,g))/2
    print(r.."x")
end

Call it with f("Grass","Water/Flying")

\$\endgroup\$
  • \$\begingroup\$ I think you could improve by using the value of m directly since it is only referenced once. \$\endgroup\$ – Ivo Beckers Sep 2 '15 at 11:12
  • \$\begingroup\$ Unless I'm misunderstanding you, saving the access of m to e is cheaper, because e is used a couple times. \$\endgroup\$ – Nikolai97 Sep 2 '15 at 16:54
  • \$\begingroup\$ No . I mean not using m at all. Remove the line 'm=' and replace 'e=m[r]' with pasting the entire table in m's place \$\endgroup\$ – Ivo Beckers Sep 2 '15 at 16:57
  • \$\begingroup\$ Ah okay, i think i understand. Do you mean something like this: e={...}[r]? Because I tried that and it is not legal :/ \$\endgroup\$ – Nikolai97 Sep 2 '15 at 17:00
  • \$\begingroup\$ Yeah I meant that. I guess I'm mistaken then. Thought it would be legal \$\endgroup\$ – Ivo Beckers Sep 2 '15 at 17:01
2
\$\begingroup\$

Python 3 - 362

k,*l=['rm gh yi is ou ck g os ee re te as ec yc e ag rk ir'.split().index(x[2:4])for x in input().replace('/',' ').split()]
s=[[0,0.5,1,2][[(ord(m)-40)//4**q%4 for m in'RB:RRRCaYR^FVBCbQRR=.bRb2caCSR^NCSbR>Q>aVFPRVRVNRbBMabRBc]bQRfR?RQBeAERQbJRFQQVSBRNJbVB]BSRRBRR3NRVRV>VQBQRW'for q in(0,1,2)][k*18+z]]for z in l]
v=s[0]*(s[1:]or[1])[0]
print(str(v//1+v%1)+'x')

Input format is the move type and the Pokemon type, separated by spaces. For example Fire Grass, or Water Steel/Electric.

The table is stored is a string where each character's index is in the range 40 to 103 and represents 3 type combinations. The list of types is stored as the 3rd and 4th (if it exists) characters of each type, which are compared to the 3rd and 4th characters of each entered type.

\$\endgroup\$
  • \$\begingroup\$ I think you can shave a few characters off by using 'rmghyiis...'.find(x[2:4])//2 instead of "rm gh yi is ...".split().index(x[2:4]) \$\endgroup\$ – Blckknght Sep 2 '15 at 7:44
  • \$\begingroup\$ Oh, that doesn't work for the bare e and g characters.... perhaps three letter prefixes could be used and you'd still have some savings from .find(...)//3 versus .split().index(...) \$\endgroup\$ – Blckknght Sep 2 '15 at 7:47
  • 3
    \$\begingroup\$ Neat, but I don't think it follows the input rules? The rules seem quite specific about requiring the / between the two types for dual typed Pokemons, e.g. Steel/Electric. \$\endgroup\$ – mattnewport Sep 2 '15 at 15:09
  • \$\begingroup\$ Oh, I missed that. It now accepts the proper input format. \$\endgroup\$ – faubi Sep 4 '15 at 7:31
1
\$\begingroup\$

PHP, 426

eval('f('.fgets(STDIN).');');
function f($a,$d){
    $x=1;$r=array_fill_keys(explode('/',$d),$a);
    while(list($d,$a)=each($r)) {
        $x*=substr(gmp_strval(gmp_init('26gXl6oUL8Ekoey31DRp2k1Jq85b0G3f1PsFPfEnL1P6Bxh4vSloX8zWWa4XPBAGavHMKLgaGhPp2JPA3qQI3L9kkQ4kSHvu2vm76aLpJmu6TV8qcPTO0hchrLRh6G9',62),5),n($a)*18+n($d),1)/2;
    }
    echo$x.'x';
}
function n($p){return strpos('NorFigFlyPoiGroRocBugGhoSteFirWatGraElePsyIceDraDarFai',substr($p,0,3))/3;}

Sample input:

"Ground", "Fire"
"Normal", "Rock/Dragon"
"Fighting", "Ghost/Steel"
"Steel", "Water/Steel"
"Ice", "Dragon/Flying"
"Water", "Ground/Water"
"Ghost", "Ghost"

Sample output:

2x
0.5x
0x
0.25x
4x
1x
2x
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.