Wolfram Language

Expansión de la base de conocimiento

Encuentre un Pokémon fuerte

Además de los cientos de tipos de entidades que abarcan dominios científicos, geográficos y otros "serios", la versión 11 incluye datos incorporados sobre entidades lúdicas, tales como Pokémon, con información sobre nombres, rutas de evolución, habilidades y estadísticas de ataque y defensa.

Encuentre la estatura de Pikachu.

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

Obtenga una asociación de datos acerca de Meowth.

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

Encuentre un Pokémon que se acerque a una altura y peso.

muestre la entrada completa 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]
Reproducir
Detener

A partir de allí, calcule los daños de combate de un Pokémon específico.

muestre la entrada completa 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]
Reproducir
Detener

Usted puede luego encontrar el Pokémon más fuerte con base en los puntos estadísticos totales.

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

Encuentre un Pokémon tipo fuego con punto de ataque mayor a 50 y punto de defensa menor a 40.

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

Encuentre un Pokémon rosado con un peso mayor a 250 libras.

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

Ejemplos relacionados

de en fr ja ko pt-br ru zh