Solución:
Rubí, 210
a=$*.map.with_index{|a,i|[a.to_i%2<<i,a.to_i[1]<<i]}.transpose.map{|a|a.inject &:+}
$><<"#{%w(Fighting
Flying
Poison
Ground
Rock
Bug
Ghost
Steel
Fire
Water
Grass
Electric
Psychic
Ice
Dragon
Dark)[a[0]*15/63]} #{a[1]*40/63+30}"
Primera vez jugando golf, así que supongo que esta es una solución bastante obvia.
CJam, 140 115 bytes
q ~]W% _1f & 2bF * 63 / "GMÿD> BÙl½} YÛöí6P¶; óKs¯¿ / · dǯã®Å[YÑÌÞ%HJ9¹G4Àv"256b25b'af+'j/=(euooSo2f/1f&2b40*63/30+
Note that the code contains unprintable characters.
Try it online in the CJam interpreter: Chrome | Firefox
Pyth, 110 bytes
J+dGA.b/*iN2CY63Cm_+0jd2_Q"("[email protected]@LJjC "! W Zm A zB0i ȏ " ? WC ǀ - # ך? Ы ܦ[email protected]J / m # "26) G3 + 30H
Esto contiene caracteres no imprimibles. Así que aquí hay un hexdump:
00000000: 4a 2b 64 47 41 2e 62 2f 2a 69 4e 32 43 59 36 33 J+dGA.b/*iN2CY63
00000010: 43 6d 5f 2b 30 6a 64 32 5f 51 22 0f 28 22 72 40 Cm_+0jd2_Q".("[email protected]
00000020: 63 73 40 4c 4a 6a 43 22 10 21 de 57 ad c8 5a 1c [email protected]".!.W..Z.
00000030: 10 6d e0 d6 12 f6 80 bc 41 85 7a 42 30 69 ae 80 .m......A.zB0i..
00000040: c8 8f 5c 22 a0 84 ab 3f 77 43 01 ca c7 80 d0 1d .."...?wC......
00000050: 2d 23 d7 9a 0a 3f d0 ab dc a6 4f 40 b9 4a 2f 6d -#[email protected]/m
00000060: d2 ca c6 23 22 32 36 29 47 33 2b 33 30 48 ...#"26)G3+30H
También puede descargar el archivo pokemon.pyth y ejecutarlo con python3 pyth.py pokemon.pyth
La entrada 30, 31, 31, 31, 30, 31
huellas dactilares
Grass
70
Explicación:
J+dGA.b/*iN2CY63Cm_+0jd2_Q".("
J+dG store the string " abc...xyz" in J
m _Q map each number d in reverse(input list) to:
jd2 convert d to base 2
+0 add a zero (list must have >= 2 items)
_ reverse the list
C zip
".(" string with the ascii values 15 and 40
.b map each N of ^^ and Y of ^ to:
iN2 convert N from base 2 to base 10
* CY multiply with the ascii value of Y
/ 63 and divide by 63
A G, H = ^
[email protected]@LJjC"longstring"26)G3+30H
C"longstring" interpret the string as bytes and convert
from base 256 to base 10
j 26 convert to base 26
[email protected] lookup their value in J and create a string
this gives "fighting flying ... dark"
c ) split by spaces
@ G take the Gth element
r 3 make the first letter upper-case and print
+30H print 30 + H
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)