Python exercise! You can use TCP, UDP for communication Please help with the fol
ID: 3583874 • Letter: P
Question
Python exercise! You can use TCP, UDP for communication
Please help with the following assignment
Build a simple, text-based version of Pokemon game. There are two modules of the game Cat à Catching and Bat à Battling.
Pokedex
Refer to the pokemon database website: www.pokedex.org to build up the pokemon database for our games (get base exp from http://bulbapedia.bulbagarden.net/wiki/List_of_Pok%C3%A9mon_by_effort_value_yield)
The pokemon database must be store in JSON file pokedex.json
At least 2 pokemons for each type
Players store their captured pokemons in a pokemon list file, json format. This file contain information about the pokemon from pokedex.json as well as other info such as level, accumulated experience.
Leveling a pokemon:
Pokemon earns exp points via pokebat (refer below)
Pokemon need to double the accumulated exp at each level to gain next level
All attributes except speed will be re-calculated: old * (1 + EV). EV by default is 0.5. Bonus: EV can be randomized from 0.5 – 1 when server spawn pokemons (refer to PokeCat)
A pokemon can be destroyed to give all its accumulated exp to a same type pokemon
Explanation / Answer
The below code is starter code for you to continue developing this Game.
#Create Pokemon class as below
class Pokemon(object):
def __init__(self,name,high,powers):
self.name=name
self.high=high
self.powers=powers
def attackOther(self,power,enemy):
enemy.high -= power.damage
# This class will calculate the damage which can happen.
class Power(object):
def __init__(self,name,damageDone):
self.name=name
self.damageDone=damageDone
# Create instnaces of Pokemon you want to fight say in tournament.
pokemon_1 = Pokemon("x",10,powers1)
pokemon_2 = Pokemon("y",500,powers2)
my_pokemon.hit(pokemon_1, pokemon_2)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.