コード例 #1
0
ファイル: getElement.py プロジェクト: EfronC/proyectoIA
def getElement(T1,T2):
	Elementos={
	"flying":3,
	"steel":9,
	"fire":10,
	"normal":1,
	"poison":4,
	"figthing":2,
	"ice":15,
	"water":11,
	"psychic":14,
	"dark":17,
	"ghost":8,
	"rock":6,
	"bug":7
	}

	el1 = pykemon.get(type_id=Elementos[T1.lower()])
	el2 = pykemon.get(type_id=Elementos[T2.lower()])

	if el2.name.lower() in el1.super_effective:
		return "weak"
	elif el2.name.lower() in el1.ineffective:
		return "strong"
	else:
		return "normal"
コード例 #2
0
ファイル: server.py プロジェクト: cornelis/ml-pokedex
 def do_POST(self):
     if self.path == '/':
         # Read form
         form = cgi.FieldStorage(
             fp=self.rfile,
             headers=self.headers,
             environ={'REQUEST_METHOD':'POST',
                      'CONTENT_TYPE':self.headers['Content-Type'],
                      })
         filename = "test"
         data = form.file.read()
         open("/tmp/%s"%filename, "wb").write(data)
         frame = Image("/tmp/%s"%filename)
         # Classify image
         cls = classifier.classify(frame)
         if cls:
             print(cls)
             # Get pokemon data from Poke Api
             pokemon = pykemon.get(pokemon=cls)
             description = pykemon.get(description_id=pokemon.descriptions[sorted(pokemon.descriptions.keys())[-1]][20:-1])
             pokemon_type = pykemon.get(type_id=pokemon.types[list(pokemon.types.keys())[0]][13:-1])
             sprite = pykemon.get(sprite_id=pokemon.sprites[sorted(pokemon.sprites.keys())[-1]][15:-1])
             self.send_response(200)
             self.send_header("Content-Type", "application/json")
             self.send_header("Connection", "close")
             self.end_headers()
             # Respond with Pokemon data in JSON
             self.wfile.write(json.dumps({'name':pokemon.name,'description':description.description,'type':pokemon_type.name,'sprite':'http://pokeapi.co/'+sprite.image}).encode())
コード例 #3
0
 def description(self, param):
     try:
         pokemon = pykemon.get(pokemon=param)
         description = choice(pokemon.descriptions.values())[:-1]
         num = description.split('/')[-1]
         description_text = pykemon.get(description=num).description
         return {'text': description_text}
     except:
         return {'error': '404 - Wrong Pokemon name'}
コード例 #4
0
ファイル: Pokemon.py プロジェクト: akshaydixi/pasta
  def description(self,param):
	try:
		pokemon = pykemon.get(pokemon=param)
		description = choice(pokemon.descriptions.values())[:-1]
		num = description.split('/')[-1]
		description_text = pykemon.get(description=num).description
		return {'text' : description_text }
        except: 
		return {'error' : '404 - Wrong Pokemon name'}
コード例 #5
0
ファイル: Pokemon.py プロジェクト: akshaydixi/pasta
 def image(self,param):
   if is_number(param):
     try:
       url = pykemon.get(sprite=int(param)).image
       return {'image' : 'http://pokeapi.co/' + url}
     except:
       return {'error' : '404 - Wrong pokemon id'}
   else:
     try:
       pid = str(pykemon.get(pokemon=param).id)
       return {'image' : 'http://pokeapi.co//media/img/' + pid + '.png'}
     except:
       return {'error' : '404 - Wrong pokemon name'}
コード例 #6
0
 def image(self, param):
     if is_number(param):
         try:
             url = pykemon.get(sprite=int(param)).image
             return {'image': 'http://pokeapi.co/' + url}
         except:
             return {'error': '404 - Wrong pokemon id'}
     else:
         try:
             pid = str(pykemon.get(pokemon=param).id)
             return {
                 'image': 'http://pokeapi.co//media/img/' + pid + '.png'
             }
         except:
             return {'error': '404 - Wrong pokemon name'}
コード例 #7
0
ファイル: Pokemon.py プロジェクト: akshaydixi/pasta
 def name(self,param):
   try:
       pokemon = pykemon.get(pokemon=param)
       name = pokemon.name
       return {'text': name}
   except:
       return {'error' : '404 - Wrong Pokemon query'} 
コード例 #8
0
 def name(self, param):
     try:
         pokemon = pykemon.get(pokemon=param)
         name = pokemon.name
         return {'text': name}
     except:
         return {'error': '404 - Wrong Pokemon query'}
コード例 #9
0
ファイル: test_pykemon.py プロジェクト: vaginessa/pykemon
 def setUp(self):
     self.poke_one = pykemon.get(pokemon='bulbasaur')
     self.move_one = pykemon.get(move_id=15)  # Cut
     self.type_one = pykemon.get(type_id=10)  # Fire
     self.ability_one = pykemon.get(ability_id=1)  # Stench
     self.egg_one = pykemon.get(egg_id=1)  # Monster
     self.description_one = pykemon.get(description_id=2)
     self.sprite_one = pykemon.get(sprite_id=152)  # Mew_auto
     self.game_one = pykemon.get(game_id=4)  # Red
コード例 #10
0
ファイル: test_pykemon.py プロジェクト: Gargamel1989/pykemon
 def setUp(self):
     self.poke_one = pykemon.get(pokemon='bulbasaur')
     self.move_one = pykemon.get(move_id=15)  # Cut
     self.type_one = pykemon.get(type_id=10)  # Fire
     self.ability_one = pykemon.get(ability_id=1)  # Stench
     self.egg_one = pykemon.get(egg_id=1)  # Monster
     self.description_one = pykemon.get(description_id=2)
     self.sprite_one = pykemon.get(sprite_id=152)  # Mew_auto
     self.game_one = pykemon.get(game_id=4)  # Red
コード例 #11
0
def des_key_validate(des_key, x):
    print("des_key: " + des_key)
    print("x: " + x)
    try:
        d = pykemon.get(description_id=des_key)
    except ResourceNotFoundError:
        return False
    return d
コード例 #12
0
ファイル: views.py プロジェクト: locolan/pokepy
def des_key_validate(des_key,x):
    print("des_key: " + des_key)
    print("x: " + x)
    try:
        d = pykemon.get(description_id=des_key)
    except ResourceNotFoundError:
        return False
    return d
コード例 #13
0
ファイル: movimiento.py プロジェクト: EfronC/proyectoIA
def getMovimiento(nombre, element):
	mov=pykemon.get(move_id=nombre)
	class movimiento():
		damage=mov.power
		pp=mov.pp
		tipo=element
		name=mov.name
	return movimiento
コード例 #14
0
ファイル: classes.py プロジェクト: snovosel/pokemon_battle
    def __init__(self, num):

        pokemon = pykemon.get(pokemon_id=num)

        self.id = num
        self.name = pokemon.name
        self.hp = 1000
        self.moves = random.sample([{
            k: v
        } for k, v in pokemon.moves.iteritems()], 10)
コード例 #15
0
ファイル: species.py プロジェクト: vladfi1/PokemonSC2
def makeSpecies(name):
    p = pykemon.get(pokemon=name)
    s = 'species.addLast(new PokemonSpecies('
    
    args = ['"%s"' % p.name, p.hp, p.attack, p.defense, p.sp_atk, p.sp_def, p.speed]
    args += ['Type.' + t.upper() for t in p.types] + ['Move.GENERIC']
    s += ', '.join(map(str, args))
    
    s += '));'
    print s
コード例 #16
0
ファイル: Main.py プロジェクト: CheapeOne/Pokai-Pokemon-AI
def test():

    pokemon1 = pykemon.get(pokemon = "blastoise")
    # print pokemon1.moves
    # move1 = pokemon1.moves[u'Ice-beam']
    # id = move1.rsplit('/',3)[2]
    # print pykemon.get(move_id = id)
    # print move1
    # myMove = pykemon.get(move_id = move1[-3:-1])
    # print myMove.pp

    #construct teeams
    #myTeam = constructTeam(myTeamText)
    #enemyTeam = constructTeam(enemyTeamText)

    move2ID = pokemon1.moves[u'Surf'].rsplit('/',3)[2]
    apiMove2 = pykemon.get(move_id = move2ID)
    print "ayy"
    print apiMove2.category
    print apiMove2.pp
コード例 #17
0
ファイル: Main.py プロジェクト: CheapeOne/Pokai-Pokemon-AI
def constructTeam(teamText):
    team = []

    for key in teamText.keys():
        apiPoke = pykemon.get(pokemon = key);
        name = key
        HP = apiPoke.hp
        apiMoves = []
        myMoves = teamText[key]

        for myMove in myMoves:
            moveURL = apiPoke.moves[myMove]
            moveID = moveURL.rsplit('/',3)[2]
            apiMove = pykemon.get(move_id = moveID)
            apiMoves.append(apiMove)

        myPoke = Poke(apiPoke, name, HP, apiMoves)
        team.append(myPoke)

    return team
コード例 #18
0
ファイル: test_pykemon.py プロジェクト: Gargamel1989/pykemon
 def test_pokemon_evolutions_attrib(self):
     self.assertEqual(len(self.poke_one.evolutions), 1)
     evo = self.poke_one.evolutions[0]
     self.assertEqual(evo.level, 16)
     self.assertEqual(evo.method, 'level_up')
     self.assertEqual(evo.resource_uri, '/api/v1/pokemon/2/')
     self.assertEqual(evo.to, 'Ivysaur')
     
     eevee = pykemon.get(pokemon='eevee')
     leafeon_evo = next(evo for evo in eevee.evolutions if evo.to == 'Leafeon')
     self.assertEqual(leafeon_evo.method, 'other')
     self.assertEqual(leafeon_evo.level, None)
コード例 #19
0
ファイル: views.py プロジェクト: shubhamdotjain/poke-bot
def evolutions(name):
    result_arr = []
    try:
        p = pykemon.get(pokemon=name)
        for keys in p.evolutions.keys():
            result_arr.append(keys)

        str1 = ' '.join(str(e) for e in result_arr)
        if len(str1) == 0:
            str1 = "No evloutions"
    except:
        str1 = " "
    return str1
コード例 #20
0
ファイル: test_pykemon.py プロジェクト: Gargamel1989/pykemon
    def test_pokemon_evolutions_attrib(self):
        self.assertEqual(len(self.poke_one.evolutions), 1)
        evo = self.poke_one.evolutions[0]
        self.assertEqual(evo.level, 16)
        self.assertEqual(evo.method, 'level_up')
        self.assertEqual(evo.resource_uri, '/api/v1/pokemon/2/')
        self.assertEqual(evo.to, 'Ivysaur')

        eevee = pykemon.get(pokemon='eevee')
        leafeon_evo = next(evo for evo in eevee.evolutions
                           if evo.to == 'Leafeon')
        self.assertEqual(leafeon_evo.method, 'other')
        self.assertEqual(leafeon_evo.level, None)
コード例 #21
0
ファイル: pokeAPI.py プロジェクト: andramirez/PokeGames
def getTypeByName(name):
    pokemon = pykemon.get(pokemon=name.lower())
    moveSet = []
    count = 0
    move=""
    while count < 2:
        if move not in moveSet and move != "":
            moveSet.append(move)
            count+=1
        else:
            key = random.randint(0,(len(pokemon.moves.keys())-1)) 
            move = pokemon.moves.keys()[key]
    
    return pokemon.types.keys()
コード例 #22
0
ファイル: views.py プロジェクト: shubhamdotjain/poke-bot
def moves(name):
    result_arr = []
    try:
        p = pykemon.get(pokemon=name)
        for keys in p.moves.keys():
            if len(result_arr) < 15:
                result_arr.append(keys)

        str2 = ', '.join(str(e) for e in result_arr)
        if len(str2) == 0:
            str2 = "No moves found"
    except:
        str2 = " "
    return str2
コード例 #23
0
def valid_address(request, form):
    poke = request.session.get('pokename')
    if (form.is_valid()):
        r = form.cleaned_data['search_query']
        print("search_query: " + r)
        try:
            poke = pykemon.get(pokemon=r)
            print("poke.name" + poke.name)

            #             try:

            p = Pokemon(
                name=poke.name,
                id=poke.id,
                description=poke.descriptions,
                egg_group=poke.egg_groups,
            )

            i = 0
            kv = ""
            p.save()
            m = poke.moves
            a = poke.abilities
            for f in m:
                butt = Moves.objects.create(move=f)
                butt.save()

            for f in a:
                ding = Abilities.objects.create(ability=f)
                ding.save()

            print("Here")
            print(p.name + " a " + p.type1 + " Pokemon!")

            request.session['pokename'] = poke.name
            print("poke.name: " + poke.name)
            print("session pokename: " + request.session.get('pokename'))

        except (pykemon.ResourceNotFoundError):
            print("Why does this keep happening?"
                  )  # INADEQUATE VALIDATION YOU F****R

        print("True")
        return True

    print("False outer")
    return False
コード例 #24
0
ファイル: views.py プロジェクト: locolan/pokepy
def valid_address(request,form):
    poke = request.session.get('pokename')
    if(form.is_valid()):
        r = form.cleaned_data['search_query'] 
        print("search_query: " + r)
        try:
            poke = pykemon.get(pokemon=r)
            print("poke.name" + poke.name)
            
#             try:

            p = Pokemon(name=poke.name, id=poke.id,
                        description=poke.descriptions, egg_group=poke.egg_groups,)
            
            i = 0
            kv=""
            p.save()
            m = poke.moves
            a = poke.abilities
            for f in m:
                butt = Moves.objects.create(move=f)
                butt.save()
                
                
            for f in a:
                ding = Abilities.objects.create(ability=f)
                ding.save()
                
            
            
            print("Here")
            print(p.name + " a " + p.type1 + " Pokemon!")
            
            request.session['pokename'] = poke.name
            print("poke.name: " + poke.name)
            print("session pokename: " + request.session.get('pokename') )
            
        except(pykemon.ResourceNotFoundError):
            print("Why does this keep happening?") # INADEQUATE VALIDATION YOU F****R

        print("True")
        return True
    
    print("False outer")
    return False
コード例 #25
0
def getPokemonTypes():
	pokemonNames = sys.argv[1].lower().split(', ')
	print('Names: {}'.format(pokemonNames))
	for pokemonName in pokemonNames:
		if "mega " in pokemonName:
			pokemonName = pokemonName.replace('"', '').replace('mega ', '')
		print('Trying: {}'.format(pokemonName))
		if pokemonName in pokemonTypeCache.keys():
			print('Using cached {}'.format(pokemonName))
			team.append(pokemonTypeCache[pokemonName])
		else:
			pokemon = pykemon.get(pokemon=pokemonName)

			if pokemon:
				if pokemon.types:
					team.append(pokemon.types.keys())
					pokemonTypeCache[pokemonName] = pokemon.types.keys()
					shouldSaveCache = 1
				else:
					print('ERROR - Couldn\'t read types from pokemon {}'.format(pokemon))
			else:
				print('ERROR - Couldn\'t get pokemon {}'.format(pokemon))
コード例 #26
0
ファイル: hook.py プロジェクト: bnookala/commit-them-all
def get_random_pokemon():
    """Generates a random pokemon sprite object using the pokeapi.co API"""
    pokemon_id = get_random_pokemon_id()
    return pykemon.get(sprite_id=pokemon_id)
コード例 #27
0
ファイル: pokeAPI.py プロジェクト: andramirez/PokeGames
def getRandomPokemon():
    pid = random.randint(1, 718) #retrieves random pokemon id
    pokemon = pykemon.get(pokemon_id=pid)
    return pokemon.name
コード例 #28
0
ファイル: test_pykemon.py プロジェクト: Gargamel1989/pykemon
 def test_type_no_effect(self):
     type_fighting = pykemon.get(type_id=2)
     self.assertIn('ghost', type_fighting.no_effect)
コード例 #29
0
ファイル: pokeAPI.py プロジェクト: andramirez/PokeGames
def getStatsByName(name):
    pokemon = pykemon.get(pokemon=name.lower())
    return pokemon.attack + pokemon.sp_atk + pokemon.defense + pokemon.sp_def
コード例 #30
0
ファイル: classes.py プロジェクト: snovosel/pokemon_battle
    def __init__(self, move_id):

        move = pykemon.get(move_id=move_id)
        self.id = move_id
        self.name = move.name
        self.power = move.power
コード例 #31
0
import pykemon

client = pykemon.V1Client()
p = pykemon.get(pokemon='charizard')
コード例 #32
0
ファイル: test_pykemon.py プロジェクト: Gargamel1989/pykemon
 def test_type_no_effect(self):
     type_fighting = pykemon.get(type_id=2)
     self.assertIn('ghost', type_fighting.no_effect)
コード例 #33
0
ファイル: pktest.py プロジェクト: xmninja/goldmine
import asyncio
import pykemon
loop = asyncio.get_event_loop()
print(loop.run_until_complete(pykemon.get(pokemon='bulbasaur')))
コード例 #34
0
ファイル: getPokemon.py プロジェクト: EfronC/proyectoIA
import pykemon
from getType import getType
from movimiento import getMovimiento
p=pykemon.get(pokemon="charizard")#6
q=pykemon.get(pokemon="poliwrath")#62
r=pykemon.get(pokemon="snorlax")#143
s=pykemon.get(pokemon="scyther")#123

def getIA():
	class Charizard():
		name=p.name
		attack=p.attack
		defense=p.defense
		speed=p.speed
		hp=(p.hp)*10
		tipo=getType(p.types)
		mov1=getMovimiento(332,"Flying")#60
		mov2=getMovimiento(231,"Steel")#100
		mov3=getMovimiento(53,"Fire")#95
		mov4=getMovimiento(14,"Normal")#UpAttack

	return Charizard

def getEquipo1():
	class Poliwrath():
		name=q.name
		attack=q.attack
		defense=q.defense
		speed=q.speed
		hp=(q.hp)*10
		tipo=getType(q.types)
コード例 #35
0
def populate_types_array():
    for x in range(1, 19):
        pkmn_type = pykemon.get(type_id=x)
        print pkmn_type
        TYPES.append(pkmn_type.name.lower())
コード例 #36
0
def search(request):
    form = SearchForm(request.POST)
    template = loader.get_template('pokepy/search.html')

    t = meth_is_POST(request, form)

    if t == True:
        print("True blue")
    elif t == False:
        return HttpResponseRedirect('/')
    else:
        context = t
        return HttpResponse(template.render(context))
    n = request.session.get('pokename')
    print('n: ' + n)
    p = Pokemon.objects.get(name=n)
    print("p: " + p.name)
    try:

        print("p.name: " + p.name)
        x = p.name.lower()
        o = (x + "_gen_6")
        print("o: " + o)
        i = 5
        des_key = ""
        desc = ""
        gen = "_gen_"
        h = str(i)
        print("h: " + h)

        descr = ""

        des_key = o
        # SELECT descriptions FROM pokepy_pokemon
        # finds p's gen 6 description
        for d in Pokemon.objects.raw(
                'SELECT *, description FROM pokepy_pokemon WHERE name = %s',
            [p.name]):
            print(type(d.description))
            print(d.description)
            mydict = dict((k.strip(), v.strip())
                          for k, v in (item.split(':')
                                       for item in d.description.split(',')))
            print("mydict:  " + str(mydict))
            for f in mydict:
                #                 f = f.replace("\'","")
                #                 f = f.replace("}","")
                #                 f = f.replace("{","")
                print("f= " + f)
                print("descr: " + descr)
                if (f == (x + "_gen_6")):
                    a = (x + "_gen_6")
                    descr = mydict[a]
                    print("descr: " + descr)
                    break

#             adesc = str(descr).replace('\'','')
#             ldesc = adesc[1]
#             desc = str(ldesc).replace('}','')
        print("description:  " + str(descr))
        print("des_key: " + des_key + "\ndescription: " + str(desc))
        #         desc = mydict[o]

        if (descr == ""):
            descr = (x + "_gen_6")
#             print(type(descr) + descr)
#         py = desc[0]
#         choice = {"description":py}
#
#         print("desc:  " + desc)
#
#         print("py: " + py)
#         print("choice = " + choice["description"])
#
#         d = pykemon.request.make_request(choice)
#         print(d)
#         d = pykemon.request._request(py)
#         description = pykemon.get(description = des_key)
        print("des_key=" + des_key)
        #         dform = des_key.replace((p.name + "_gen_6"),"")
        #         print("dform="+dform)
        d = pykemon.get(description_id=des_key)

        print("am i even")
        context = RequestContext(request, {
            'name': p.name,
            'd': d,
            'form': form,
        })

        print(context)
        return HttpResponse(template.render(context))

    except AttributeError:
        return HttpResponseRedirect('/')
コード例 #37
0
ファイル: views.py プロジェクト: locolan/pokepy
def search(request): 
    form = SearchForm(request.POST)
    template = loader.get_template('pokepy/search.html')
    
    t = meth_is_POST(request, form)
    
    if t == True:
        print("True blue")
    elif t == False:
        return HttpResponseRedirect('/')
    else:    
        context = t
        return HttpResponse(template.render(context))
    n = request.session.get('pokename')
    print('n: ' + n)
    p = Pokemon.objects.get(name=n)
    print("p: " + p.name )
    try:
       
        print( "p.name: " + p.name )
        x = p.name.lower()
        o = (x + "_gen_6")
        print("o: " + o)
        i=5
        des_key=""
        desc=""
        gen = "_gen_"
        h = str( i )
        print( "h: " + h )
        
        descr = ""
        
        des_key = o
        # SELECT descriptions FROM pokepy_pokemon
        # finds p's gen 6 description 
        for d in Pokemon.objects.raw('SELECT *, description FROM pokepy_pokemon WHERE name = %s', [p.name]):
            print(type(d.description))
            print(d.description)
            mydict = dict((k.strip(), v.strip()) for k,v in (item.split(':') for item in  d.description.split(',')))
            print("mydict:  " + str(mydict))
            for f in mydict:
#                 f = f.replace("\'","")
#                 f = f.replace("}","")
#                 f = f.replace("{","")
                print("f= " + f)
                print("descr: " + descr)
                if(f == (x + "_gen_6")):
                    a = (x + "_gen_6")
                    descr = mydict[a]
                    print("descr: " + descr)
                    break
                
             
#             adesc = str(descr).replace('\'','')
#             ldesc = adesc[1]
#             desc = str(ldesc).replace('}','')
        print("description:  " + str(descr))
        print( "des_key: " + des_key + "\ndescription: " + str(desc) )
#         desc = mydict[o]
        
        
        if(descr == ""):
            descr = (x + "_gen_6")
#             print(type(descr) + descr)
#         py = desc[0]    
#         choice = {"description":py}
#         
#         print("desc:  " + desc)
#         
#         print("py: " + py)
#         print("choice = " + choice["description"])
#         
#         d = pykemon.request.make_request(choice)
#         print(d)
#         d = pykemon.request._request(py)
#         description = pykemon.get(description = des_key)
        print("des_key=" + des_key)
#         dform = des_key.replace((p.name + "_gen_6"),"")
#         print("dform="+dform)
        d = pykemon.get(description_id=des_key)
        
        print("am i even")
        context = RequestContext(request, {'name':p.name, 'd':d,    
            'form': form,
        })
        
        print(context)
        return HttpResponse(template.render(context))
        
    except AttributeError:
        return HttpResponseRedirect('/')
コード例 #38
0
from sys import argv
import pykemon
import json

script = argv

target = open("test.json", 'w')

i = 1
#make requests to the pokemon api to create a json object
datas = []
try:
	while True:
		dataobj = {}
		p = pykemon.get(pokemon_id= i)
		dataobj["name"] = str(p.name)
		dataobj["id"] = str(p.id)
		dataobj["abilities"] = str(p.abilities.keys())
		dataobj["types"] = str(p.types.keys())
		dataobj["gendermfratio"] = str(p.male_female_ratio)
		dataobj["catch_rate"] = str(p.catch_rate)
		datas.append(dataobj);
		i = i + 1
except:
	pass
json.dump(datas, target)
target.close()
コード例 #39
0
ファイル: game.py プロジェクト: DevinMui/cli-pokemon
import pykemon as pk
import random
import json
user_choice = raw_input('Choose your Pokemon: ')
print
try:
	user_pokemon = pk.get(pokemon = user_choice.lower())
# pokemon doesnt exist
except:
	print "That Pokemon doesn't exist! Sorry!"

print "You picked: " + user_pokemon.name
print

# move = poke.moves.keys()[0] # gets a move
# poke.moves[move] # gets api data from move
# len(poke.moves) # returns dict objects

user_moves = [] # moves from the api so i dont have to keep calling it
readable_moves = [] # readable moves for user
# gets 4 random moves
for i in xrange(4):
	rand = random.randint(0,len(user_pokemon.moves))
	user_moves.append(pk.get(move_id = user_pokemon.moves[user_pokemon.moves.keys()[rand]][13:-1])) # appends the move name to array

for i in xrange(len(user_moves)):
	readable_moves.append(user_moves[i].name)

print "These are your moves: " + ' '.join(readable_moves)
print
# 720 pokemons
コード例 #40
0
    pokeNum = d*m*name_len
    while(pokeNum>649):
        pokeNum /= 2

    return pokeNum

if __name__=="__main__":
    pokeNumSet = set()
    start_date = datetime.date(2000,1,1) #Use a leap year
    end_date = datetime.date(2001,1,1)
    delta_t = datetime.timedelta(days=1)
    cur_date = start_date
    while(cur_date<end_date):
        max_name_len = 30
        for name_len in range(1,max_name_len):
            m = cur_date.month
            d = cur_date.day
            pokeNumSet.add(getPokemon(m, d, name_len))
        cur_date += delta_t

    #pokeNumSet contains all possible results
    allPokeNums = set()
    for i in range(1,650):
        allPokeNums.add(i)

    impossiblePokeNums = allPokeNums.difference(pokeNumSet)
    for pokeNum in impossiblePokeNums:
        pokemon = pykemon.get(pokemon_id=pokeNum)
        print pokemon.name+",",

コード例 #41
0
"""A throwaway file I can do stuff in"""
#pylint: disable=W0141, C0301, I0011
from pykemon import get
import evScrape, eggScrape, evoScrape, grwScrape, mfrScrape

f = file("pokemon.txt", 'w')

for n in range(1, 152):
    pokemon = get(pokemon=n)
    pokemon.abilities = map(str, pokemon.abilities)
    pokemon.egg_groups = map(str, pokemon.egg_groups)
    pokemon.evolutions = map(str, pokemon.evolutions)
    pokemon.types = map(str, pokemon.types)
    pokemon.moves = map(str, pokemon.moves)

    pokemonD = ("'{0}':{{'name':'{0}', 'baseHealth':{1}, 'baseAttack':{2}, 'baseDefense':{3}, "
                "'baseSpAttack':{4}, 'baseSpDefense':{5}, 'baseSpeed':{6}, "
                "'abilities':{7}, 'eggGroups':{8}, 'evolutions':{9}, 'types':{10}, 'moves':{11}, " 
                "'exp':{12}, 'height':{13}, 'ev':{{'hp':{14}, 'attack':{15}, 'defense':{16}, "
                "'spAttack':{17}, 'spDefense':{18}, 'speed':{19}}}, 'eggCycles':{20}, "
                "'evoNum':{21}, 'growthRate':'{22}', 'maleFemaleRatio':{23}, 'weight':{24}, 'num':{25}}},\n").format(pokemon.name, pokemon.hp, pokemon.attack, pokemon.defense, pokemon.sp_atk, pokemon.sp_def, pokemon.speed, pokemon.abilities, pokemon.egg_groups, pokemon.evolutions, pokemon.types, pokemon.moves, pokemon.exp, pokemon.height, evScrape.scrape(n, 1), evScrape.scrape(n, 2), evScrape.scrape(n, 3), evScrape.scrape(n, 4), evScrape.scrape(n, 5), evScrape.scrape(n, 6), eggScrape.scrape(n), evoScrape.scrape(pokemon.name), grwScrape.scrape(pokemon.name), mfrScrape.scrape(n), pokemon.weight, pokemon.id)
    f.write(str(pokemonD).encode('ascii', 'ignore'))

f.close()