final corrections before submission
This commit is contained in:
@@ -21,7 +21,6 @@ class Pokemon:
|
||||
self.moves_dict[move] = copy.deepcopy(gd.available_moves[move])
|
||||
self.curr_hp = self.baseStats['hp']
|
||||
|
||||
|
||||
def _get_baseStats(self):
|
||||
return self.baseStats
|
||||
|
||||
@@ -51,9 +50,6 @@ class Pokemon:
|
||||
self.moves_dict[move] = copy.deepcopy(gd.available_moves[move])
|
||||
|
||||
def _compute_effect(self, move, opponent):
|
||||
#check the move type (attack) and the defending
|
||||
#pokemon type (defend) and look at effectiveness list.
|
||||
#this should be done for all type of the defending pokemon
|
||||
attack_move_type = move['type']
|
||||
defending_types = opponent.get_types()
|
||||
|
||||
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
import json
|
||||
import random
|
||||
|
||||
#load moves from json file
|
||||
#eclude moves with power equal to null,
|
||||
# do not consider the effect,effects or changes fields
|
||||
|
||||
#exclude moves with power equal to null,
|
||||
#do not consider the effect,effects or changes fields
|
||||
available_moves = dict()
|
||||
keys_to_skip = ['effect','effects','changes']
|
||||
with open('moves.json', 'r') as file:
|
||||
@@ -33,7 +33,7 @@ with open('pokemons.json', 'r') as file:
|
||||
for m in available_moves.keys():
|
||||
if available_moves[m]['type'] in current_pokemon_types:
|
||||
compatible_moves.append(m)
|
||||
#select two random moves
|
||||
#select two (compatible) random moves
|
||||
selected_moves = [random.choice(compatible_moves) for _ in range(2)]
|
||||
pokemons_dict[p['name']]['moves'] = selected_moves
|
||||
|
||||
|
||||
+7
-4
@@ -1,3 +1,4 @@
|
||||
import os
|
||||
from core import Trainer
|
||||
|
||||
import random
|
||||
@@ -68,11 +69,7 @@ def Main(starter_choice,Nbattles):
|
||||
try:
|
||||
starter_name = starter_choice
|
||||
trainer = Trainer(name='edo', starter_name=starter_name)
|
||||
#print(f"{trainer.name} has chosen {trainer.starter} as their starter Pokemon!")
|
||||
#print("Adding potions and pokeballs to your inventory...")
|
||||
trainer.items = {"potions": 10, "pokeball": 10}
|
||||
#print("Your character is ready!")
|
||||
#print(f"Welcome {trainer.name}! Your adventure begins now!")
|
||||
except ValueError as e:
|
||||
print(e)
|
||||
print("Something went wrong!")
|
||||
@@ -98,6 +95,8 @@ def Main(starter_choice,Nbattles):
|
||||
|
||||
def make_plots(Ngames,Nbattles):
|
||||
#SIMPLE PLOT
|
||||
if os.path.exists('plots') == False:
|
||||
os.makedirs('plots')
|
||||
cumulative_victories = np.zeros((Ngames,Nbattles))
|
||||
plt.figure(figsize=(10, 6))
|
||||
for starter_choice in gd.available_starters:
|
||||
@@ -171,6 +170,10 @@ def make_plots(Ngames,Nbattles):
|
||||
if __name__ == "__main__":
|
||||
Ngames = 500
|
||||
Nbattles = 100
|
||||
if os.path.exists('results') == False:
|
||||
os.makedirs('results')
|
||||
if os.path.exists('plots') == False:
|
||||
os.makedirs('plots')
|
||||
for starter_choice in gd.available_starters:
|
||||
for i in range(Ngames):
|
||||
print(f"Generating data for {starter_choice}, game {i}...")
|
||||
|
||||
Reference in New Issue
Block a user