Question
Language: Python Program used: Processing 3.0 - - pokedex.txt: bulbasaur,grass ivysaur,grass venusaur,grass charmander,fire charmeleon,fire charizard,fire squirtle,water wartortle,water blastoise,water caterpie,bug metapod,bug butterfree,bug weedle,bug kakuna,bug beedrill,bug pidgey,flying
Language: Python
Program used: Processing 3.0
-
-
pokedex.txt:
bulbasaur,grass ivysaur,grass venusaur,grass charmander,fire charmeleon,fire charizard,fire squirtle,water wartortle,water blastoise,water caterpie,bug metapod,bug butterfree,bug weedle,bug kakuna,bug beedrill,bug pidgey,flying pidgeotto,flying pidgeot,flying rattata,normal raticate,normal spearow,flying fearow,flying ekans,poison arbok,poison pikachu,electric raichu,electric sandshrew,ground sandslash,ground nidoranfemale,poison nidorina,poison nidoqueen,poison nidoranmale,poison nidorino,poison nidoking,poison clefairy,fairy clefable,fairy vulpix,fire ninetales,fire jigglypuff,fairy wigglytuff,fairy zubat,flying golbat,flying oddish,grass gloom,grass vileplume,grass paras,bug parasect,bug venonat,poison venomoth,poison diglett,ground dugtrio,ground meowth,normal persian,normal psyduck,water golduck,water mankey,fighting primeape,fighting growlithe,fire arcanine,fire poliwag,water poliwhirl,water poliwrath,water abra,psychic kadabra,psychic alakazam,psychic machop,fighting machoke,fighting machamp,fighting bellsprout,grass weepinbell,grass victreebel,grass tentacool,water tentacruel,water geodude,rock graveler,rock golem,rock ponyta,fire rapidash,fire slowpoke,psychic slowbro,psychic magnemite,electric magneton,electric farfetchd,flying doduo,flying dodrio,flying seel,water dewgong,water grimer,poison muk,poison shellder,water cloyster,water gastly,ghost haunter,ghost gengar,ghost onix,rock drowzee,psychic hypno,psychic krabby,water kingler,water voltorb,electric electrode,electric exeggcute,grass exeggutor,grass cubone,ground marowak,ground hitmonlee,fighting hitmonchan,fighting lickitung,normal koffing,poison weezing,poison rhyhorn,ground rhydon,ground chansey,normal tangela,grass kangaskhan,normal horsea,water seadra,water goldeen,water seaking,water staryu,water starmie,water mr.mime,psychic scyther,bug jynx,psychic electabuzz,electric magmar,fire pinsir,bug tauros,normal magikarp,water gyarados,water lapras,water ditto,normal eevee,normal vaporeon,water jolteon,electric flareon,fire porygon,normal omanyte,rock omastar,rock kabuto,rock kabutops,rock aerodactyl,flying snorlax,normal articuno,ice zapdos,electric moltres,fire dratini,dragon dragonair,dragon dragonite,dragon mewtwo,psychic mew,psychic
Purpose: Practice creating and using dictionaries as mappings Degree of Difficulty: Easy Each pokemon has a type associated Pokemon are fantastic creatures that people can catch and train. with it: examples of types include fire, grass, water and electric, to name but a few. Information about pokemon types is stored in a document known as the Pokedex. For this question, your job is to write a Processing program that allows the user to type in a pokemon's name and display to the user the type for that pokemon, as listed in the Pokedex. Input file:s For this program, you are provided a data file, pokedex.txt, that you should add to your sketch's "data" folder: There are only two items on each line of pokedex.txt: the name of a pokemon and that pokemon's type separated by a comma. Program Behaviour Use a 600x4OO canvas size Your program should read in the data from the file pokedex.txt. The data should be stored in your program using a single dictionary as a mapping. This means that the keys for your dictionary will be pokemon names, and the values for your dictionary will be types. (a) The dictionary itself should be a global variable in your program (b) The code to load the data from file into the dictionary should be in setup, since it only needs to be done once Your program should allow the user to type in the name of a pokemon on the keyboard. Do this by having a single global variable, name, and concatenating each key to that variable as it is pressed. When the user clicks the mouse (it doesn't matter where). the program should display on the canvas the type for the pokemon name that the user entered, and then reset your name variable so that a new pokemon can be typed in later. If the pokemon does not exist in the pokedex, display an appropriate error message to the canvasStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started