Ini sangat efektif!

42

Ini sangat efektif!

Di Pokemon ada 18 jenis:

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

Pokemon dapat memiliki pengetikan tunggal atau ganda. Misalnya, Pikachu adalah Electric, dan Tyranitar adalah Rock/Dark. Urutan jenisnya tidak masalah. Pokemon tidak dapat memiliki tipe yang sama dua kali. Langkah menyerang memiliki tepat salah satu dari 18 jenis di atas.

  • Beberapa tipe Pokémon lemah terhadap jenis serangan tertentu. Misalnya, FirePokemon lemah terhadap Waterserangan. Ini memberikan pengganda kerusakan 2.

  • Beberapa tipe Pokemon tahan terhadap jenis serangan tertentu. Misalnya, RockPokemon tahan terhadap Normalserangan. Ini memberikan pengali kerusakan 0,5.

  • Beberapa tipe Pokémon kebal terhadap jenis serangan tertentu. Misalnya, FlyingPokemon kebal terhadap Groundserangan. Ini memberikan pengganda kerusakan 0.

Pokemon bisa dua kali lipat lemah, dua kali lipat kebal atau kombinasi lainnya terhadap tipe serangan. Lipat gandakan pengganda untuk mendapatkan efektivitas total.

Tulis program atau fungsi yang memberikan tipe gerakan dan hasil pengetikan Pokemon menghasilkan pengganda kerusakan total dari serangan. Pengetikan Pokémon selalu ditulis sebagai Aatau A/B, di mana Adan Bmerupakan tipe yang berbeda dari daftar di atas. Anda harus menerima pengetikan Pokemon dalam format ini. Selain dari pembatasan ini, Anda dapat mengambil input dengan cara yang wajar. Contoh format input yang dapat diterima adalah:

"Ice", "Dragon/Flying"

Tapi ini tidak bisa diterima:

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

Output Anda harus persis salah satu dari string berikut, diikuti oleh baris tambahan opsional:

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

Contohnya

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

Ketik efektivitas

Untuk bagan tipe ramah-manusia, saya ingin merujuk Anda ke Gamepedia . Untuk membuat proses golf sedikit lebih cepat, saya akan memberikan Anda matriks efektifitas terkompresi yang ramah komputer. Bagilah setiap angka dengan dua untuk mendapatkan pengganda yang benar (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

Kode terpendek dalam byte menang.

orlp
sumber
4
Saya suka tantangan berbasis video-game!
kirbyfan64sos
7
Saya lebih suka berpura-pura bahwa jenis Peri tidak ada. Pokemon semakin memburuk semakin banyak yang mereka tambahkan.
mbomb007
34
PPCG menggunakan CJam! Ini sangat efektif! PPCG menggunakan Java! Ini tidak terlalu efektif ...
Fatalkan
10
Jangan dengarkan artinya ol 'mbomb007, Togekiss kecil. Semua orang tahu Anda lebih baik dengan mengetik Peri.
Geobits
4
Seseorang harus menulis jawaban di Pikalang ! (Semoga beruntung.)
mbomb007

Jawaban:

16

Pyth - 246 245 188 byte

Mengkodekan matriks dengan kompresi dasar, mungkin akan menggunakan pengindeksan / hashing modular untuk indeks matriks tapi sekarang saya belum melakukan sesuatu yang mewah dengan itu.

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 .

Maltysen
sumber
10
Apakah Anda yakin itu program dan bukan derau baris?
Markus
17

Java, 663 639 582 byte

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;}

Ada meja pencarian sederhana yang memakan banyak ruangan. Itu hanya menemukan jenis yang benar dan mengalikannya. Sebut saja seperti ini:

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

Dengan beberapa jeda baris terlihat seperti ini:

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;
}
Geobit
sumber
1
Anda dapat mencukur beberapa byte dengan menggunakanc="222...442".split(",");
Ypnypn
Kanan. Tidak yakin mengapa saya melakukannya untuk yang satu dan bukan yang lain: /
Geobits
Anda ingin menjelaskan ini kepada kami? Saya sangat tertarik tetapi tidak mengerti apa yang terjadi lol :)
duxfox--
2
Bisakah Anda mencukur byte menggunakan for(String B:b)for-loop Anda mulai dari 24 menjadi 15, menyimpan 9, dan menjadikan Anda [b[i++]]sebagai Buntuk 7 penghematan lebih. Total 16 penghematan!
corsiKa
1
@ Luminous Saya tidak yakin tentang itu. Sejak saya kembali i, saya harus mengurangi satu nanti atau memulainya -1, yang mana akan meniadakan byte yang disimpan.
Geobits
9

JavaScript (ES6), 287

Saya belum melihat kompresi jenis yang baik, jadi ini salah satunya.

(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'

Tidak Disatukan:

(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, dan inilah bagan saya (ingat itu dipesan sehingga surat tidak akan cocok dengan kata-kata yang tercantum di bawahnya):

"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"
Bukan itu Charles
sumber
Kerja bagus! Saya punya ide yang sama, tetapi Anda harus duluan!
MayorMonty
1
Jika Anda menyandikan string nilai yang sudah disandikan atob, Anda dapat menyimpan 26 byte dengan menggunakannya btoa. Ketika Anda menyandikannya, pastikan untuk menambahkan karakter tambahan karena "...pew5"menjadi "...peww=="karena perataan byte.
SLuck49
@ Sluck49 Terima kasih. Saya mencobanya dan sepertinya lebih sedikit karakter tetapi lebih banyak byte. Apakah saya melakukan sesuatu yang salah?
Bukan itu Charles
Tembak Anda benar, saya melihat jumlah karakter alih-alih jumlah byte ... karakter UTF-8 multi byte yang bodoh.
SLuck49
@ SLuck49 Kemungkinan ada cara yang lebih baik untuk menyandikan pengganda. Ada banyak ruang kosong dengan semua 2 itu.
Bukan itu Charles
9

Pikalang, 868068 byte

Ini terlalu bagus untuk dilewati. ( Terima kasih, mbomb007. )

Ini pada dasarnya tabel pencarian yang kurang optimal. Saya pertama kali mengkodekan setiap jenis sebagai

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

Ini menghasilkan representasi unik untuk setiap jenis. Jenis kosong (ketika pokemon yang membela hanya memiliki satu jenis) dikodekan sebagai 0x00.

Setelah itu saya hanya menggunakan kekacauan yang if-elsesetara untuk memeriksa semua ~ 5800 kombinasi.

Kode

Stack Exchange tidak mengizinkan saya memposting kode secara keseluruhan, jadi ini dia 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/9vtT6d9ekMdfP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dlFxXH+bdi9NXT1cbhMXEjEUIFqKrkilkN+Rcz9Rr6g1faAykvV4ZU1cKhOrCQDa7nANsDkIeQ0y90an3y7Od+/QIyYPoEmI9IQ0uITDXuZ6BNzrwHod59+J4k7kuDITqEiIkBkJ1YSCbXZg5jIWc6xlpjbRpGyxkdz0+hOoSIgTucg7OIdp1hphwTbilqy0EBAlxhTAxrrsh7fXiXEIugDT18hv1zKffLPvapz5G6hx/d44L9//jewMuvRAhQnTpEjK6cSHLIW/+BQERbJ84yIBtSoA09SJEiNHizh/aD8S5C1npMn2aPms2XYiQSZCmXoSUQ6guISEQo6pRtXS1hXBdYyFjGxeyu16cawGkqZcyyEOXsdRYWrPpYyHWKz1YIULqXBgI1TUWcq5nNjWbpm0wH6JrZD0hu+vxIR6IEAZkbz2DZ0LwPM6sfR83XnyqCwPJXxTMKANnlwlprxfnaj+QvfWMcwlx7vWzHXRh+RCqS8huiI1PaxwDaa8nZHe9JyFG0OgIehwmZqO+BYHeDiGDIZjGnQPb1QRp6kXIHRATpAlyxqZfDxnbeJxLiJAYyGZXez0h6RAz7KYMexwDZheECBHCg2Aadw5CslxCUlxniLF0UyxdfZjXb9TdG4y5MboQ9aguzByECNElZCTEIGuQnbHp10Pa68W5MBCqCwOhusZCbHxa43zIQ5dBNjrIfnm21H3zQgoRIsR60w5WSB6E6jpDzLDRGfY4TF9fr/h4yNjGhQgRQq8n5JsQU6optXS1B0Ha6wkRIoReDwPBNK5rocuoalSt2XQhQnRlQ9rrCdld70pIUy9XQIybxs3S1RYCgugSImSGCwOhuoTshpzr/Xvd4xf9/w/v9d85//kf/wsHs6nq5j4NAA==

Contoh

Rupanya penerjemah resmi Pikalang belum siap, tetapi karena ini adalah pengganti Brainfuck yang sepele, saya mengujinya menggunakan penerjemah Brainfuck.

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

Input dipisahkan oleh baris baru dan memerlukan baris tambahan tambahan baru.

Program ini menggunakan lokasi memori -1, jadi jika penerjemah Anda tidak diizinkan keluar dari sisi kiri kaset, tambahkan kode dengan a pipiatau a >(masing-masing untuk Pikalang dan Brainfuck).

Brainfuck, 193708

Berikut adalah program yang sama di Brainfuck (juga + gzped base64'd).

H4sICGI+6FUAC3N1cGVyZWZmZWN0aXZlLWdvbGZlZC5iZgDtXQt2GzkOPJDjOYEeL6Ln+19jbHmsyKNPgwSqUCDpfTuTqBokgC4WAEab/dP+nN9Pb2/t4/vfn794u/x8/u79+vP54fnP399+tD9Gs/Z+bu+n043t+d3yc27t7XQ6v398fLR2Pr21t4/Tx4NNPx9pb1+PfrSvjz43PH8anR778vP5F9K+f9Hefv+035//7ynb00ePDX9+evjzmaDPn/eviNpXnN+/+f7V29d/v//xzPz880quL+b8339+v7Pz3a/Ot1bn91+v9vrx6YRZH7Xuz7/b7c8npd6/2PP70ytmBnuepYBQ4xf4/ec4N+0rv1fklByI4kxRcBFuQVaGUgmwL0fu2yrEivr8GETjbCKOg3Mxy4HzSVYnkpGduKR6Qif+ObNvquBDwGaRYp4hRD+bV+mRXoJ5ehQ0+cVHXaDAKc0xRyRwbRrs9B7xfAEpKlsizpAqG0gkWMLVgRwo6hb2eAqJGKSbAaxb8kohFRQimSsgvX7bgKP8y58tb3HJmREXtWo54TSfu17iAxUaI6TCWahMlk8qGqeUxiB8fnI5QTROA3se34LlBb14KiddzpFBAuH2twsjQKjxC7xTCV1u2lfWmkiLEYs6a4jNU7f43FyCpE/pYsG4HY5DbXIa5c+bfPEwvvOJ7ip+Nk9VJAalIs66bUU+M8XmRrg0w/aQIVz4SUnTlla2ec5936TJa5ZOWZgqD3HSwL5HLG/UihMspGF++AhJhcwrExlVtGq9BEni5nUfatw0tQks6NSXqKiZ8JXVCDUSGHWk9RvDW+5UB5v25NYZnlIZfAJSNHAXPkd2RToi0IoDiyZqpxqPuqMSz7V8cQvA2+RUcoJePIgFXXadK20ZUqKHAYxoaavMjB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/Yt642ijLJ/krj1KxzJXdyynOHAvbjBecL30IrESnPmDLO2u22GuUPZ3U8YdS2CVnkwJmEYk16ESVNjT1PiAMZgiONwRSBN0tV+HGzv1o7w1w5lA+YgX2KPllxxOo31puaJpywRqNKaYcgHsf1N1NSKWE8r9BqC4TuPiVqggRplx3rHj2iP7F3g2Vk6W5z+XphxUf9HXcaNNa5Ga06qbli06t8T0D6+PYcXKbSxUQrNN3FV7s0UVLkUW4u+zajOpNR0oz4IhwKyZd3CSrBc5vwC7VuuAWk1tLfffPi6PFBg8IB4N/P60qlKM0gdxCodYG0K8+vKNCLhzbZMGnFefayKC9EMiCuVJoG8a1kXlCOBJJHBeH5hCTz4mn98EAgo+uSIsli1xNi8VPVby+in6ieS587N/sL9rrUNgviqYi8Vil8em0K286E81ryUmTyBASreK71cefhxSNK7pK5lnDbkNLdp6gaqstyR6QmZgo1pce+4slI8VyRbO6AEAOVF08xFpwRVEdKbNQ5tAo9I0nsXqGKugIFGyseCh1ZU2QZMNR5+PcCT5lELMEsQjR/sgKWiG4vOWka1zASt5b+iqNoCwnxLDdLdSVSjl3UdkBMXduuuxhQwAWJbVdjF2RlJeHrXHTrVgAYWkzkwDzjhe48HDiPZfzLDu5ZzeDUEzrx+1D7pjzuULNQhTE3+6upfT4z4ldMCLhCbVNqUyClJ9LTPdkFRFVJ03AOi7RRV5BIsYTrghmETPHcWIzVxAtSRQDrKhE6BJ9Dve42Tx9gXJslG4sPE7e46oyIC1wJrNJHLVEqY6JVOd9K4Go1Ml8oaoHUcaQHX4RdTtCL55O+x2jrVQjoxRV9FgvowrdPpJ3/aR//ArQnatCs9AIA

Program ini berisi empat bagian:

  1. Input. Membaca jenis dan menghitung pengidentifikasi mereka.
  2. Pembuatan teks. Menghasilkan string untuk masing-masing output yang mungkin.
  3. Tabel pencarian. Bagian ini dibuat oleh komputer (lihat di bawah). Memindahkan pointer ke hasil yang benar.
  4. Hasil. Hanya mencetak hasilnya.

Struktur program utama

,>,[-<++>],[-<+++>] 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

Berikut skrip yang menghasilkan tabel pencarian:

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, jawaban ini membutuhkan 29.817 byte. :)

PurkkaKoodari
sumber
Sungguh, penerjemah belum siap? Bagaimana dengan disini ?
mbomb007
@ mbomb007 Yah, setidaknya yang Anda tautkan sebelumnya tidak. Saya tidak yakin tentang yang satu itu (BFC), ia tidak mencantumkan Pikalang di halaman depan dan saya juga tidak yakin apakah itu berfungsi (tergantung pada ruang parsing yang benar, PIPIdapat diartikan sebagai >atau ++). Juga BFC tampaknya akan membutuhkan kode casing yang besar.
PurkkaKoodari
Terima kasih @ Pietu1998 untuk membuat versi pikalang. lucu! sekarang jika saya dapat menemukan waktu untuk menyelesaikan bahasa ini seperti yang saya inginkan daripada cara cepat dan kotor. Terima kasih lagi
groteworld
5

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

Masukan harus berupa stdin dan dalam bentuk Normal, Rock/Dragon

Versi langsung .

Dengan spasi putih:

#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";
}
mattnewport
sumber
3

Tcl, 382

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

Skrip berisi data terkompresi termasuk byte non-UTF-8. Berikut ini skrip persis yang dikodekan dalam basis 64:

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

Menggunakan zlibperintah untuk kompresi.

Johannes Kuhn
sumber
Itu sebenarnya bukan skrip tcl yang valid sekarang?
slebetman
1
@slebetman Ini adalah skrip tcl yang disandikan di base64.
orlp
2
ingin menjelaskan apa fungsinya?
Bukan itu Charles
3

Lua, 758 661 633 byte

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

Tidak Disatukan:

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

Sebut saja dengan f("Grass","Water/Flying")

Nikolai97
sumber
Saya pikir Anda dapat meningkatkan dengan menggunakan nilai mlangsung karena hanya direferensikan sekali.
Ivo Beckers
Kecuali saya salah paham dengan Anda, menghemat akses mke elebih murah, karena edigunakan beberapa kali.
Nikolai97
Tidak . Maksud saya tidak menggunakan m sama sekali. Hapus baris 'm =' dan ganti 'e = m [r]' dengan menempelkan seluruh tabel di tempat m
Ivo Beckers
Ah oke, saya pikir saya mengerti. Apakah maksud Anda seperti ini e={...}[r]:? Karena saya mencobanya dan itu tidak sah: /
Nikolai97
Ya saya maksudkan itu. Saya kira saya salah kalau begitu. Kupikir itu legal
Ivo Beckers
2

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')

Format input adalah tipe bergerak dan tipe Pokemon, dipisahkan oleh spasi. Misalnya Fire Grass, atau Water Steel/Electric.

Tabel disimpan adalah string di mana indeks masing-masing karakter berada dalam kisaran 40 hingga 103 dan mewakili 3 jenis kombinasi. Daftar jenis disimpan sebagai karakter ke-3 dan ke-4 (jika ada) dari masing-masing jenis, yang dibandingkan dengan karakter ke-3 dan ke-4 dari setiap jenis yang dimasukkan.

faubi
sumber
Saya pikir Anda dapat mencukur beberapa karakter dengan menggunakan 'rmghyiis...'.find(x[2:4])//2alih-alih"rm gh yi is ...".split().index(x[2:4])
Blckknght
Oh, itu tidak berhasil untuk karakter telanjang edan gkarakter .... mungkin tiga awalan huruf dapat digunakan dan Anda masih akan memiliki penghematan dari .find(...)//3versus.split().index(...)
Blckknght
3
Rapi, tapi menurut saya tidak mengikuti aturan input? Aturan tampaknya cukup spesifik tentang mengharuskan /antara dua jenis untuk Pokemon berjenis ganda, misalnya Steel/Electric.
mattnewport
Oh, aku merindukan itu. Sekarang menerima format input yang tepat.
faubi
1

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;}

Input sampel:

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

Output sampel:

2x
0.5x
0x
0.25x
4x
1x
2x
Rusty Fausak
sumber