Welcome, Pokemon Trainer!

Lewis De La Rosa
3 min readNov 15, 2020

Growing up, me and my brother were obsessed with Pokemon and the chance to “be the very best!”. For those of you who don’t already know, Pokemon is a game where you catch and train powerful creatures used to battle!

While I focused on the training and the battling part of the game, trying to make my Pokemon team the best they could possibly be. My brother focused on following the slogan of “catching them all”. He always aimed to fill the in-game library of Pokemon known as the PokeDex. Thus, came the idea of my CLI Project. This is for him.

The goal of my project is to print out a specific Pokemon’s name and type. I want to build on this to where it not only prints those two values, but also all the other traits of a Pokemon. This includes their height, weight, order number, weaknesses, strengths, characteristics and even what games they appear in.

This app starts out with asking if the user wants to accept the challenge of being “the very best” or if they want to exit the program, which they can do by entering “All my Pokemon have fainted”. This is a nod to the game where, when all your Pokemon faint in battle, your character blacks out and runs to the nearest Pokemon Center to heal them all. With accepting the prompt, the CLI prints out a list of Pokemon for the user to choose from. The user can then select the desired Pokemon and see a list of that specific Pokemon’s types.

I’m excited to build on this to eventually create a full PokeDex for everyone to use to help them create their Pokemon teams. My brother was especially excited to see the result of my CLI and can’t wait to see the end results of it.

In my project I use a lot of methods. The first includes the self method, which depending on how its used can call on either the whole class itself or the instance of our Pokemon. The class relating to all Pokemon that come from the program created. A class can be seen as a factory creating all the Pokemon that is given to us through the program. An instance would be a singal individual Pokemon that comes from the program.

Class and instance variables are also used throughout my program. Class variables relate to all Pokemon that come through the class as well where instance variables will relate to a specific Pokemon, like defined above. An example of a class variable would be if all my Pokemon were boys, that would relate to all of them. But an instance would be each Pokemons individual characteristics, like height or weight.

I also use the attr_accessor method to create my getter and setter methods for each Pokemons values that I want to set through my program. In my program specifically, I get and set their names and their types. There are a huge number of attributes we could get and set using this, but I decided to keep it simple.

Lastly, I want to go over the differences a class method and an instance method. Much like the variables, class methods are meant for the class as a whole representing all Pokemon. Whereas instance methods will apply to whatever instance we choose of the Pokemon we create.

For anyone interested in looking into the code, here is the link for it: https://github.com/JT-Infinity/pokemon_cli

--

--