def init_game(): # Fake Battle Values battle_vals = dict() battle_vals['Level'] = 100 battle_vals['# Poke'] = 6 battle_vals['Items'] = True battle_vals['Tier'] = 'Uber' battle_vals['Players'] = 'CPU vs. CPU' # Initial teams. Random for now. team1 = pkmn_test.random_Team() team1.Name = 'Player 1' team2 = pkmn_test.random_Team() team2.Name = 'Player 2' # Prep Teams for Battle team1.init_battle(battle_vals) team2.init_battle(battle_vals) # Location for where battle_vals['# Poke'] will be respected # Initialize Players player1 = pokeStructs.Player('CPU', team1) player2 = pokeStructs.Player('CPU', team2) # Initialize Fields left_field = pokeStructs.Field() right_field = pokeStructs.Field() main_field = pokeStructs.Field() # Initialize Sides left = pokeStructs.Side(player1, left_field) right = pokeStructs.Side(player2, right_field) # Initialize Game game = pokeStructs.Game(left, right, main_field) return game
def debug(): screen.nodelay(0) screen.clear() selection = -1 option = 0 lines = [ 'Rand Team', 'Rand Poke', 'Rand Move', 'Rand Item', 'Rand Ability', 'Exit' ] while selection < 0: graphics = [0] * len(lines) graphics[option] = curses.A_REVERSE title = 'TogePy' screen.addstr(0, (dims[1] - len(title)) / 2, title) #Show Title for i, l in enumerate(lines): screen.addstr((dims[0] - len(lines)) / 2 + i, (dims[1] - len(l)) / 2, l, graphics[i]) screen.refresh() action = screen.getch() if action == curses.KEY_UP: option = (option - 1) % len(lines) elif action == curses.KEY_DOWN: option = (option + 1) % len(lines) elif action == ord('\n'): selection = option elif action == ord('q'): selection = action screen.refresh() screen.clear() if selection == 0: d_team(pkmn_test.random_Team()) debug() elif selection == 1: d_poke(pkmn_test.random_Poke()) debug() elif 2 <= selection <= 4: under_Construction() debug() else: menu()
def debug(): screen.nodelay(0) screen.clear() selection = -1 option = 0 lines = ['Rand Team', 'Rand Poke', 'Rand Move', 'Rand Item', 'Rand Ability', 'Exit'] while selection < 0: graphics = [0]*len(lines) graphics[option] = curses.A_REVERSE title = 'TogePy' screen.addstr(0, (dims[1] - len(title))/2, title) #Show Title for i, l in enumerate(lines): screen.addstr((dims[0] - len(lines))/2 + i, (dims[1] - len(l))/2, l, graphics[i]) screen.refresh() action = screen.getch() if action == curses.KEY_UP: option = (option - 1)%len(lines) elif action == curses.KEY_DOWN: option = (option + 1)%len(lines) elif action == ord('\n'): selection = option elif action == ord('q'): selection = action screen.refresh() screen.clear() if selection == 0: d_team(pkmn_test.random_Team()) debug() elif selection == 1: d_poke(pkmn_test.random_Poke()) debug() elif 2 <= selection <= 4: under_Construction() debug() else: menu()
def select_team(player): screen.nodelay(0) screen.clear() selection = -1 option = 0 rand_team = pkmn_test.random_Team() teams = save.get_Files('TEAM') + ['Random'] lines = [ 'Team', 'Member_1', 'Member_2', 'Member_3', 'Member_4', 'Member_5', 'Member_6', 'Confirm' ] title = player + ' Team Selection' #Create dictionaries needed to support selections vals = dict(zip(range(len(lines)), [0] * len(lines))) strvals = dict(zip(range(len(lines)), [''] * len(lines))) maxval = dict(zip(range(len(lines)), [1] * len(lines))) #Set max unique values for each option maxval[0] = len(teams) while selection < 0: # Display Static Information graphics = [0] * len(lines) graphics[option] = curses.A_REVERSE screen.clear() screen.addstr(1, (dims[1] - len(title)) / 2, title, curses.A_BOLD) for i, l in enumerate(lines): screen.addstr(2 * i + 3, 1, l, graphics[i]) screen.border() # Update string values for each option strvals[0] = teams[vals[0]] # Grab team if strvals[0] == 'Random': team = rand_team else: team = save.load_Team(strvals[0]) # Update string values with poke for i in range(1, 7): if team.pos_open(i): strvals[i] = '' else: poke = team.get_Member(i) strvals[i] = poke.Name # Display Current Choices for i in range(len(lines) - 1): screen.addstr(2 * i + 3, len(lines[i]) + 2, strvals[i]) # Flush to Screne screen.refresh() # Key Stuff action = screen.getch() if action == curses.KEY_UP: option = (option - 1) % len(lines) elif action == curses.KEY_DOWN: option = (option + 1) % len(lines) elif action == curses.KEY_LEFT: vals[option] = (vals[option] - 1) % maxval[option] elif action == curses.KEY_RIGHT: vals[option] = (vals[option] + 1) % maxval[option] elif action == ord('\n'): if option == 0: d_team(team) elif option in range(1, 7): d_poke(team.get_Member(option)) elif option == 7: selection = option elif action == ord('q'): selection = option elif action == ord('d'): d_team(team) screen.refresh() screen.clear() return team
def select_team(player): screen.nodelay(0) screen.clear() selection = -1 option = 0 rand_team = pkmn_test.random_Team() teams = save.get_Files('TEAM') + ['Random'] lines = ['Team', 'Member_1', 'Member_2', 'Member_3', 'Member_4', 'Member_5', 'Member_6', 'Confirm'] title = player + ' Team Selection' #Create dictionaries needed to support selections vals = dict(zip(range(len(lines)), [0]*len(lines))) strvals = dict(zip(range(len(lines)), ['']*len(lines))) maxval = dict(zip(range(len(lines)), [1]*len(lines))) #Set max unique values for each option maxval[0] = len(teams) while selection < 0: # Display Static Information graphics = [0]*len(lines) graphics[option] = curses.A_REVERSE screen.clear() screen.addstr(1, (dims[1]-len(title))/2, title, curses.A_BOLD) for i, l in enumerate(lines): screen.addstr(2*i+3, 1, l, graphics[i]) screen.border() # Update string values for each option strvals[0] = teams[vals[0]] # Grab team if strvals[0] == 'Random': team = rand_team else: team = save.load_Team(strvals[0]) # Update string values with poke for i in range(1, 7): if team.pos_open(i): strvals[i] = '' else: poke = team.get_Member(i) strvals[i] = poke.Name # Display Current Choices for i in range(len(lines)-1): screen.addstr(2*i+3, len(lines[i])+2, strvals[i]) # Flush to Screne screen.refresh() # Key Stuff action = screen.getch() if action == curses.KEY_UP: option = (option - 1)%len(lines) elif action == curses.KEY_DOWN: option = (option + 1)%len(lines) elif action == curses.KEY_LEFT: vals[option] = (vals[option]-1)%maxval[option] elif action == curses.KEY_RIGHT: vals[option] = (vals[option]+1)%maxval[option] elif action == ord('\n'): if option == 0: d_team(team) elif option in range(1, 7): d_poke(team.get_Member(option)) elif option == 7: selection = option elif action == ord('q'): selection = option elif action == ord('d'): d_team(team) screen.refresh() screen.clear() return team
import pkmn_test import extract_feats # Test feature extraction on a random team team = pkmn_test.random_Team() tmext = extract_feats.teamExtractor(team, prefix='') tmext.extract() feats = tmext.getFeats() print 'Basic Extraction' print len(feats.keys()) # Test more battlee feature extraction team.init_battle({'Level':'As Is'}) # Fake battle vals tmext = extract_feats.teamExtractor(team, True, prefix='1') tmext.extract() feats = tmext.getFeats() print '\n\nAdvanced Extraction' print len(feats.keys()) items = feats.items() items.sort() for item in items: print item