2017-04-21 04:04:47 +00:00
|
|
|
# Module for printing various information.
|
|
|
|
|
|
|
|
import extractor
|
|
|
|
|
2017-04-21 03:24:04 +00:00
|
|
|
|
|
|
|
def print_usage():
|
2017-04-25 15:20:15 +00:00
|
|
|
# Print the instructions of usage.
|
2017-04-21 04:04:47 +00:00
|
|
|
print(
|
|
|
|
'''
|
|
|
|
Usage:
|
2017-04-24 08:49:04 +00:00
|
|
|
pokemon [parameter]
|
2017-04-21 04:04:47 +00:00
|
|
|
|
2017-04-24 08:49:04 +00:00
|
|
|
Parameters:
|
|
|
|
[name] - Change the terminal background to the specified Pokemon.
|
|
|
|
[index] - Change the terminal background to a Pokemon by its index.
|
|
|
|
[region] - List all the Pokemon of the specified region.
|
|
|
|
[letter] - List all Pokemon who's names begin with a particular letter.
|
2017-04-21 04:04:47 +00:00
|
|
|
|
2017-04-24 08:49:04 +00:00
|
|
|
Other Parameters:
|
2017-04-25 15:32:44 +00:00
|
|
|
pokemon all - List all the Pokemon supported.
|
|
|
|
pokemon random - Pick a Pokemon at random.
|
2017-04-25 19:46:49 +00:00
|
|
|
pokemon ? - Identify the current Pokemon.
|
2017-04-25 15:32:44 +00:00
|
|
|
pokemon regions - List all the available regions.
|
|
|
|
pokemon slideshow - Iterate through each Pokemon.
|
|
|
|
pokemon slideshow-kanto - Iterate through each Pokemon in the specified reigon.
|
|
|
|
pokemon help - Display this menu.
|
2017-04-24 08:49:04 +00:00
|
|
|
''')
|
2017-04-21 03:24:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
def print_list(list_of_items):
|
2017-04-25 15:20:15 +00:00
|
|
|
# Print all the items in a list. Used for printing each Pokemon from a particular region.
|
2017-04-21 03:24:04 +00:00
|
|
|
for item in list_of_items:
|
|
|
|
print(item)
|
|
|
|
|
|
|
|
|
2017-04-21 06:23:49 +00:00
|
|
|
def add_zeroes(pokemon):
|
2017-04-25 15:20:15 +00:00
|
|
|
# Add zeros to the front so that it begins with 3 digits.
|
|
|
|
# Example: "2 Ivysaur" -> "002 Ivysaur"
|
2017-04-21 06:23:49 +00:00
|
|
|
zeroes = ""
|
|
|
|
if int(pokemon.split(' ')[0]) < 10:
|
|
|
|
zeroes = "00"
|
|
|
|
elif int(pokemon.split(' ')[0]) < 100:
|
|
|
|
zeroes = "0"
|
|
|
|
return zeroes + pokemon
|
|
|
|
|
|
|
|
|
2017-04-21 04:04:47 +00:00
|
|
|
def print_columns(items, i, j):
|
2017-04-25 15:20:15 +00:00
|
|
|
# Print a list as multiple columns instead of just one.
|
2017-04-21 04:04:47 +00:00
|
|
|
rows = []
|
|
|
|
items_per_column = int((j - i) / 3) + 1
|
2017-04-21 03:24:04 +00:00
|
|
|
|
|
|
|
for index in range(i, j):
|
2017-04-21 04:04:47 +00:00
|
|
|
name = items[index][:-1]
|
2017-04-21 03:24:04 +00:00
|
|
|
|
2017-04-21 04:27:01 +00:00
|
|
|
# For formatting: this helps line up columns correctly where a short name would otherwise ruin it.
|
2017-04-21 03:24:04 +00:00
|
|
|
if len(name) < 10:
|
2017-04-21 04:27:01 +00:00
|
|
|
name += " "
|
|
|
|
|
2017-04-21 04:04:47 +00:00
|
|
|
if len(rows) < items_per_column:
|
2017-04-21 06:41:20 +00:00
|
|
|
rows.append(name)
|
2017-04-21 03:24:04 +00:00
|
|
|
else:
|
2017-04-21 06:41:20 +00:00
|
|
|
rows[(index - i) % items_per_column] += "\t\t" + name
|
2017-04-21 04:04:47 +00:00
|
|
|
|
|
|
|
print_list(rows)
|
|
|
|
|
2017-04-21 03:24:04 +00:00
|
|
|
|
2017-04-21 04:04:47 +00:00
|
|
|
def print_region(i, j):
|
2017-04-25 15:20:15 +00:00
|
|
|
# Helper method for printing all the Pokemon in a particular region.
|
2017-04-21 04:04:47 +00:00
|
|
|
print_columns(extractor.load_names(), i, j)
|
2017-04-21 03:24:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
def print_kanto():
|
2017-04-25 15:20:15 +00:00
|
|
|
# Print each Kanto region Pokemon and its corresponding number.
|
2017-04-21 03:24:04 +00:00
|
|
|
print_region(0, 151)
|
|
|
|
|
|
|
|
|
|
|
|
def print_johto():
|
2017-04-25 15:20:15 +00:00
|
|
|
# Print each Johto region Pokemon and its corresponding number.
|
2017-04-21 03:24:04 +00:00
|
|
|
print_region(151, 251)
|
|
|
|
|
|
|
|
|
|
|
|
def print_hoenn():
|
2017-04-25 15:20:15 +00:00
|
|
|
# Print each Hoenn region Pokemon and its corresponding number.
|
2017-04-21 03:24:04 +00:00
|
|
|
print_region(251, 386)
|
|
|
|
|
|
|
|
|
|
|
|
def print_sinnoh():
|
2017-04-25 15:20:15 +00:00
|
|
|
# Print each Sinnoh region Pokemon and its corresponding number.
|
2017-04-21 04:04:47 +00:00
|
|
|
print_region(386, 493)
|
|
|
|
|
|
|
|
|
|
|
|
def print_all():
|
2017-04-25 15:20:15 +00:00
|
|
|
# Print all the Pokemon for all the regions supported.
|
2017-04-21 04:04:47 +00:00
|
|
|
print_region(0, 493)
|
|
|
|
|
|
|
|
|
|
|
|
def print_pokemon_starting_with(char):
|
2017-04-25 15:20:15 +00:00
|
|
|
# Print all the Pokemon who's names begin with a particular letter.
|
2017-04-21 04:04:47 +00:00
|
|
|
pokemon = extractor.pokemon_starting_with(char)
|
|
|
|
print_columns(pokemon, 0, len(pokemon))
|
2017-04-21 06:23:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
def print_regions():
|
2017-04-25 15:20:15 +00:00
|
|
|
# Print all the supported regions.
|
2017-04-21 06:23:49 +00:00
|
|
|
print("Kanto")
|
|
|
|
print("Johto")
|
|
|
|
print("Hoenn")
|
|
|
|
print("Sinnoh")
|