4
1
I'm always forgetting Pokemon type matchups. This is a challenge to print the pokemon type chart!
Attacking Type
No Fi Fl Po Gr Ro Bu Gh St Fr Wa Gr El Ps Ic Dr Da Fa
Normal 1.0 2.0 1.0 1.0 1.0 1.0 1.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
Fighting 1.0 1.0 2.0 1.0 1.0 0.5 0.5 1.0 1.0 1.0 1.0 1.0 1.0 2.0 1.0 1.0 0.5 2.0
D Flying 1.0 0.5 1.0 1.0 0.0 2.0 0.5 1.0 1.0 1.0 1.0 0.5 2.0 1.0 2.0 1.0 1.0 1.0
e Poison 1.0 0.5 1.0 0.5 2.0 1.0 0.5 1.0 1.0 1.0 1.0 0.5 1.0 2.0 1.0 1.0 1.0 0.5
f Ground 1.0 1.0 1.0 0.5 1.0 0.5 1.0 1.0 1.0 1.0 2.0 2.0 0.0 1.0 2.0 1.0 1.0 1.0
e Rock 0.5 2.0 0.5 0.5 2.0 1.0 1.0 1.0 2.0 0.5 2.0 2.0 1.0 1.0 1.0 1.0 1.0 1.0
n Bug 1.0 0.5 2.0 1.0 0.5 2.0 1.0 1.0 1.0 2.0 1.0 0.5 1.0 1.0 1.0 1.0 1.0 1.0
d Ghost 0.0 0.0 1.0 0.5 1.0 1.0 0.5 2.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 2.0 1.0
i Steel 0.5 2.0 0.5 0.0 2.0 0.5 0.5 1.0 0.5 2.0 1.0 0.5 1.0 0.5 0.5 0.5 1.0 0.5
n Fire 1.0 1.0 1.0 1.0 2.0 2.0 0.5 1.0 0.5 0.5 2.0 0.5 1.0 1.0 0.5 1.0 1.0 0.5
g Water 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 0.5 0.5 0.5 2.0 2.0 1.0 0.5 1.0 1.0 1.0
Grass 1.0 1.0 2.0 2.0 0.5 1.0 2.0 1.0 1.0 2.0 0.5 0.5 0.5 1.0 2.0 1.0 1.0 1.0
T Electric 1.0 1.0 0.5 1.0 2.0 1.0 1.0 1.0 0.5 1.0 1.0 1.0 0.5 1.0 1.0 1.0 1.0 1.0
y Psychic 1.0 0.5 1.0 1.0 1.0 1.0 2.0 2.0 1.0 1.0 1.0 1.0 1.0 0.5 1.0 1.0 2.0 1.0
p Ice 1.0 2.0 1.0 1.0 1.0 2.0 1.0 1.0 2.0 2.0 1.0 1.0 1.0 1.0 0.5 1.0 1.0 1.0
e Dragon 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 0.5 0.5 0.5 0.5 1.0 2.0 2.0 1.0 2.0
Dark 1.0 2.0 1.0 1.0 1.0 1.0 2.0 0.5 1.0 1.0 1.0 1.0 1.0 0.0 1.0 1.0 0.5 2.0
Fairy 1.0 0.5 1.0 2.0 1.0 1.0 0.5 1.0 2.0 1.0 1.0 1.0 1.0 1.0 1.0 0.0 0.5 1.0
It has to take an optional parameter that specifies a single type and then prints the dual type chart for that type, which looks like:
Attacking Type
No Fi Fl Po Gr Ro Bu Gh St Fr Wa Gr El Ps Ic Dr Da Fa
Electric/- 1.0 1.0 0.5 1.0 2.0 1.0 1.0 1.0 0.5 1.0 1.0 1.0 0.5 1.0 1.0 1.0 1.0 1.0
Electric/Normal 1.0 2.0 0.5 1.0 2.0 1.0 1.0 0.0 0.5 1.0 1.0 1.0 0.5 1.0 1.0 1.0 1.0 1.0
D Electric/Fighting 1.0 1.0 1.0 1.0 2.0 0.5 0.5 1.0 0.5 1.0 1.0 1.0 0.5 2.0 1.0 1.0 0.5 2.0
e Electric/Flying 1.0 0.5 0.5 1.0 0.0 2.0 0.5 1.0 0.5 1.0 1.0 0.5 1.0 1.0 2.0 1.0 1.0 1.0
f Electric/Poison 1.0 0.5 0.5 0.5 4.0 1.0 0.5 1.0 0.5 1.0 1.0 0.5 0.5 2.0 1.0 1.0 1.0 0.5
e Electric/Ground 1.0 1.0 0.5 0.5 2.0 0.5 1.0 1.0 0.5 1.0 2.0 2.0 0.0 1.0 2.0 1.0 1.0 1.0
n Electric/Rock 0.5 2.0 0.3 0.5 4.0 1.0 1.0 1.0 1.0 0.5 2.0 2.0 0.5 1.0 1.0 1.0 1.0 1.0
d Electric/Bug 1.0 0.5 1.0 1.0 1.0 2.0 1.0 1.0 0.5 2.0 1.0 0.5 0.5 1.0 1.0 1.0 1.0 1.0
i Electric/Ghost 0.0 0.0 0.5 0.5 2.0 1.0 0.5 2.0 0.5 1.0 1.0 1.0 0.5 1.0 1.0 1.0 2.0 1.0
n Electric/Steel 0.5 2.0 0.3 0.0 4.0 0.5 0.5 1.0 0.3 2.0 1.0 0.5 0.5 0.5 0.5 0.5 1.0 0.5
g Electric/Fire 1.0 1.0 0.5 1.0 4.0 2.0 0.5 1.0 0.3 0.5 2.0 0.5 0.5 1.0 0.5 1.0 1.0 0.5
Electric/Water 1.0 1.0 0.5 1.0 2.0 1.0 1.0 1.0 0.3 0.5 0.5 2.0 1.0 1.0 0.5 1.0 1.0 1.0
T Electric/Grass 1.0 1.0 1.0 2.0 1.0 1.0 2.0 1.0 0.5 2.0 0.5 0.5 0.3 1.0 2.0 1.0 1.0 1.0
y Electric/Psychic 1.0 0.5 0.5 1.0 2.0 1.0 2.0 2.0 0.5 1.0 1.0 1.0 0.5 0.5 1.0 1.0 2.0 1.0
p Electric/Ice 1.0 2.0 0.5 1.0 2.0 2.0 1.0 1.0 1.0 2.0 1.0 1.0 0.5 1.0 0.5 1.0 1.0 1.0
e Electric/Dragon 1.0 1.0 0.5 1.0 2.0 1.0 1.0 1.0 0.5 0.5 0.5 0.5 0.3 1.0 2.0 2.0 1.0 2.0
Electric/Dark 1.0 2.0 0.5 1.0 2.0 1.0 2.0 0.5 0.5 1.0 1.0 1.0 0.5 0.0 1.0 1.0 0.5 2.0
Electric/Fairy 1.0 0.5 0.5 2.0 2.0 1.0 0.5 1.0 1.0 1.0 1.0 1.0 0.5 1.0 1.0 0.0 0.5 1.0
The best dual type charts I've found is here, don't forget to list even the non-existent combinations, by clicking 'Show all types'. Types combine by multiplication, except for the same time (eg. electric/electric which is actually electric/-). White space in the output is only important between columns and rows (to remain legibility).
This is code golf so shortest bytes wins.
related and related – Rod – 2017-01-02T13:15:05.343
What about the ordering of the types? – busukxuan – 2017-01-02T13:25:16.063
4Normally, instead of 0.3, it is actually 0.25 then you have to identify STAB bonuses... – Anthony Pham – 2017-01-02T13:58:57.383
1@PythonMaster I mean the order in which they appear in the table, should they be exactly as listed by OP? – busukxuan – 2017-01-02T13:59:38.377
You should keep the number of spaces consistent. There are four spaces in between the first
Fighting
and the numbers. There are only three spaces in between theElectric/Fighting
and the numbers. – ericw31415 – 2017-01-02T15:23:59.287@PythonMaster Not sure how 0.3 crept in there, I'd remove it but I presume the answers would be trivially different so I'll leave it in there – Pureferret – 2017-01-03T09:19:27.877
@busukxuan the ordering of rows is not important – Pureferret – 2017-01-03T09:20:21.427
@Pureferret my guess is you rounded your calculations to one decimal place, which would round 0.25 to 0.3 – Patrick Roberts – 2017-01-04T07:47:55.627
@PatrickRoberts indeed, it was more how did I not notice it? – Pureferret – 2017-01-04T18:17:05.507
In the dual type chart, does the double type need to be first? – FlipTack – 2017-12-10T09:34:36.290
@fliptack first only – Pureferret – 2017-12-10T13:09:42.317