Wolfram Language

Élargissement de la base de connaissances

Trouvez un Pokémon puissant

En plus des centaines de types d'entité couvrant les domaines scientifiques, géographiques et autres domaines « sérieux », la version 11 inclut également des données intégrées sur des entités amusantes telles que les Pokémon, avec des informations sur les noms, les chemins évolutifs, les capacités et les statistiques d'attaque et de défense.

Trouvez la hauteur de Pikachu.

In[1]:=
Click for copyable input
Entity["Pokemon", "Pokedex0025:Pikachu"][ EntityProperty["Pokemon", "Height"]]
Out[1]=

Obtenez une association de données sur Miaouss.

In[2]:=
Click for copyable input
Entity["Pokemon", "Pokedex0052:Meowth"]["PropertyAssociation"]
Out[2]=

Trouvez un Pokémon correspondant le mieux à une taille et un poids donné.

Afficher l'entrée complète de Wolfram Language
In[3]:=
Click for copyable input
Manipulate[ Grid@Partition[ Normal@EntityValue[ Entity["Pokemon", {"Weight" -> Quantity[ Interval[{w - 5, w + 5}], "Kilograms"], "Height" -> Quantity[ Interval[{h - 5, h + 5}], "Centimeters"]}], "Image", "EntityAssociation"] /. r_Rule :> Tooltip[r[[2]], r[[1]]], UpTo[3]], {{w, 30, "weight (kg)"}, 10, 200, 1, Appearance -> "Open"}, {{h, 130, "height (cm)"}, 100, 200, 1, Appearance -> "Open"}, ContinuousAction -> False, SynchronousUpdating -> False, SynchronousInitialization -> False]
Jouer l'animation
Arrêter l'annimation

À partir de là, vous pouvez calculer les dommages de combat pour un Pokémon spécifique.

Afficher l'entrée complète de Wolfram Language
In[4]:=
Click for copyable input
Style[Manipulate[DynamicModule[{damage}, damage = ((((2*level*(criticalHit /. {True -> 2, False -> 1})/5 + 2)*attack*power/defense)/50 + 2)*(MatchQ[ Intersection @@ EntityValue[{attPokemon, defPokemon}, "Type"], {}] /. {True -> 1, False -> 1.5})*typeModifier)* Interval[{85, 100}]/100; Column[{Row[{"base statistics:"}, BaseStyle -> Bold], Grid[{{Null, "attacker", "defender"}, {"image", attPokemon["Image"], defPokemon["Image"]}, {"name", attPokemon["Name"], defPokemon["Name"]}, {"HP", attPokemon["HitPoints"], defPokemon["HitPoints"]}, {"attack", attPokemon["Attack"], defPokemon["Attack"]}, {"defense", attPokemon["Attack"], defPokemon["Defense"]}, {"special attack", attPokemon["Attack"], defPokemon["SpecialAttack"]}, {"special defense", attPokemon["Attack"], defPokemon["SpecialDefense"]}}, Background -> {None, {Lighter[Yellow, .9], {White, Lighter[Gray, .8]}}}, Frame -> All, FrameStyle -> Directive[Gray, Thick], Spacings -> {1, 1}], Row[{Null}], Row[{"damage:"}, BaseStyle -> Bold], Grid[{{"min", "average", "max"}, {N[Min[#]], N[Mean @@ #], N[Max[#]]} &@damage}, Frame -> All, FrameStyle -> Directive[Gray, Thick], Spacings -> {1, 1}, Background -> {None, {Lighter[Yellow, .9], White}}] }, BaseStyle -> {FontFamily -> "Helvetica"}] ], {{level, 50, "level"}, 1, 100, ControlType -> InputField}, {{attPokemon, Entity["Pokemon", "Pokedex0025:Pikachu"], "attacking Pokemon"}, pm, ControlType -> PopupMenu}, {{attack, 35, "attack"}, 1, 1000, ControlType -> InputField}, {{power, 90, "power"}, 1, 300, ControlType -> InputField}, {{defPokemon, Entity["Pokemon", "Pokedex0052:Meowth"], "defensing Pokemon"}, pm, ControlType -> PopupMenu}, {{defense, 35, "defense"}, 1, 1000, ControlType -> InputField}, {{typeModifier, 1, "type modifier"}, {4, 2, 1, 0.5, 0.25, 0}, ControlType -> PopupMenu}, {{criticalHit, False, "critical hit"}, {True, False}, ControlType -> Setter}, ContinuousAction -> False, SynchronousUpdating -> False, ControlPlacement -> Bottom, SynchronousInitialization -> False, Initialization :> {pm = First /@ SortBy[Normal@ EntityValue[EntityClass["Pokemon", All], "Name", "EntityAssociation"], Last]}], DynamicEvaluationTimeout -> Infinity]
Jouer l'animation
Arrêter l'annimation

Vous pouvez alors trouver les Pokémon les plus puissants en fonction de leur nombre total de points de statistiques.

In[5]:=
Click for copyable input
powerful = EntityList[ Entity["Pokemon", { "Generation" -> Entity["PokemonGeneration", "GenerationI"], "StatTotal" -> TakeLargest[10]}]]
Out[5]=

Trouvez un Pokémon de feu avec un point d'attaque supérieur à 50 et un point de défense de moins de 40.

In[6]:=
Click for copyable input
EntityValue[EntityList[ Entity["Pokemon", { "Type" -> "Fire", "Attack" -> GreaterThan[50], "Defense" -> LessThan[40]}]], "Image", "EntityAssociation"]
Out[6]=

Trouvez un Pokémon rose avec un poids supérieur à 150 kg.

In[7]:=
Click for copyable input
EntityValue[EntityList[ Entity["Pokemon", { "PokedexColor" -> Entity["PokemonPokedexColor", "Pink"], "Weight" -> GreaterThan[ Quantity[250, "Pounds"]]}]], "Image", "EntityAssociation"]
Out[7]=

Exemples connexes

de en es ja ko pt-br ru zh