Re:Julia's multiple dispatch explained with Pokemons
by adgjlsfhk1 on Wednesday July 21, 2021 @12:21AM
(#27902295)
This solution works until you have 1 type that has a different fallback than everything else.
[ Parent
| on HN ]
Re:Julia's multiple dispatch explained with Pokemons
by ALittleLight on Wednesday July 21, 2021 @12:44AM
(#27902424)
I think it would still work. You would just need to define every attacker-defender pair for that type. If types with different fallbacks were common then you'd just define a dictionary of attack effectiveness fallbacks and the attack_effectiveness function would get from the attacker-defender dictionary and default to fallback for the attacker type.