Wolfram 언어

Knowledgebase의 확장

강력한 포켓몬 찾기

과학, 지리 등의 "진지한" 분야를 커버하는 수백가지 엔티티 유형 이외에 버전 11은 포켓몬 같은 재미있는 엔티티의 임베디드 데이터를 포함하고 있습니다. 포켓몬의 이름, 진화의 경위, 능력, 공격과 방어의 통계에 대한 정보 등을 내장하고 있습니다.

피카츄의 신장을 구합니다.

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

나옹에 대한 데이터의 연상을 얻습니다.

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

주어진 신장과 체중에 가장 가까운 포켓몬을 구합니다.

전체 Wolfram 언어 입력 표시하기
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]
동영상 작동
동영상 정지

이러한 데이터에서 특정 포켓몬에 대한 배틀 데미지를 계산할 수 있습니다.

전체 Wolfram 언어 입력 표시하기
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]
동영상 작동
동영상 정지

통계값의 종합점에 따라 가장 강력한 포켓 몬스터를 찾습니다.

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

공격 포인트가 50보다 크고, 방어 포인트가 40보다 작은 불꽃 타입의 포켓 몬스터를 찾습니다.

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

체중이 250 파운드 이상인 분홍 포켓몬스터를 찾습니다.

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

관련 예제

de en es fr ja pt-br ru zh