Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

class PokemonSelectionGUI: def init ( self , master ) : self.master = master self.master.title ( Pok mon Selection ) self.selected _ pokemon = tk

class PokemonSelectionGUI:
def init(self, master):
self.master = master
self.master.title("Pokmon Selection")
self.selected_pokemon = tk.StringVar()
self.create_widgets()
def create_widgets(self):
self.pokemon_listbox = tk.Listbox(self.master, selectmode=tk.SINGLE)
for pokemon in pokemon_list: # Fixed the variable name here
self.pokemon_listbox.insert(tk.END, pokemon)
self.pokemon_listbox.bind(">", self.update_image)
self.pokemon_listbox.pack(pady=10)
self.pokemon_image = tk.Label(self.master, text="?", font=("Arial",20))
self.pokemon_image.pack(pady=10)
self.choose_button = tk.Button(self.master, text="Choose", command=self.choose_pokemon)
self.choose_button.pack(pady=10)
def update_image(self, event):
selected_index = self.pokemon_listbox.curselection()
if selected_index:
pokemon_name = self.pokemon_listbox.get(selected_index[0])
# Here you would update the image based on the selected Pokmon
self.pokemon_image.config(text=pokemon_name)
def choose_pokemon(self):
selected_index = self.pokemon_listbox.curselection()
if selected_index:
self.selected_pokemon.set(self.pokemon_listbox.get(selected_index[0]))
# Here you could proceed to the next step, like showing the selection window for player 2
root = tk.Tk()
app = PokemonSelectionGUI(root)
root.mainloop()
print(df)
Also the 18 Pokemons we are going to use are given below, drop all others:
Bulbasaur
Ivysaur
Venusaur
Charmander Charmeleon Charizard
Squirtle
Wartortle Blastoise Caterpie Metapod Butterfree
3
Weedle
Kakuna
Beedrill
Pidgey
Pidgeotto Pidgeot
Above figures you see only 6 Pokemons for each player, but cleaned dataset had 18 of
them? Where are the rest 12 Pokemons?
If you are not familiar with Pokemon universe, pokemons can evolve as they grow up
or fight and get stronger. In the dataset we cleaned actually has 6 different Pokemons,
and every Pokemons has their evolution level 2 and 3. In the battles, the Pokemon
who won the round will get evolved and both it's attributes and image will change. So
other 12 Pokemon will appear in the next phases of the battles.
After both players choose their Pokemons, battle will begin.
Battles are performed turn based, one player hits and after him other player hits. So
be sure when it's one player's turn, other player has to wait and can not attack.
In the figure as you see, since it's Player 1's turn (Player 1 starts the game) buttons
of Player 2 are disabled.
Players have two options: physical attack and elemental attack. Difference of physical
and elemental attack is like as follows (do not forget to multiply by 5 the health value
of Pokemons given in the csv):
Physical: Can give damage between 75%-100% of Pokemon's attack value.
Elemental: Can give damage between 50%-100% of Pokemon's attack value, if
attacker is elementally stronger than defender Pokemon, damage will
be doubled with a 80% chance.Above figures you see only 6 Pokemons for each player, but cleaned dataset had 18 of
them? Where are the rest 12 Pokemons?
If you are not familiar with Pokemon universe, pokemons can evolve as they grow up
or fight and get stronger. In the dataset we cleaned actually has 6 different Pokemons,
and every Pokemons has their evolution level 2 and 3. In the battles, the Pokemon
who won the round will get evolved and both it's attributes and image will change. So
other 12 Pokemon will appear in the next phases of the battles.
After both players choose their Pokemons, battle will begin.
Battles are performed turn based, one player hits and after him other player hits. So
be sure when it's one player's turn, other player has to wait and can not attack.
In the figure as you see, since it's Player 1's turn (Player 1 starts the game) buttons
of Player 2 are disabled.
Players have two options: physical attack and elemental attack. Difference of physical
and elemental attack is like as follows (do not forget to multiply by 5 the health value
of Pokemons given in the csv):
Physical: Can give damage between 75%-100% of Pokemon's attack value.
Elemental: Can give damage between 50%-100% of Pokemon's attack value, if
attacker is elementally stronger than defender Pokemon, damage will
be doubled with a 80% chance.Here you need to add the functionality to buttons, they will do the calculations of attack and decrease the HP of opponent, and visually represent it on the screen. Health bars of Pokemons will be updated after every attack (Dont forget to take 5*health of Pokemons from dataset!!!
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Database Modeling With Neo4j

Authors: Ajit Singh

2nd Edition

B0BDWT2XLR, 979-8351798783

More Books

Students also viewed these Databases questions