Pokemon Type Battle Stat Tracker

How I built my very first CLI application.

Michael Werling
3 min readMar 21, 2021

My first month at the Flatiron School’s FT Software Engineering program has been nothing short of amazing. The amount of information that I have learned about computer programming has kept me busy, but it is a joy to wake up every morning and learn more about this incredible field.

At the end of each month in the program, we are tasked with creating our very own project from scratch. For our first project, we were tasked with pulling data from a remote source on the internet and manipulating it using the Ruby programming language. The final program would allow an ordinary user to interact with this information using a basic Command Line Interface (CLI).

From start to finish, it took me about a week to complete the entire project. I am not going to lie, the longest part of the process was trying to decide what I wanted to do. I looked through multiple free APIs (Application Programming Interfaces) online anddatabase websites that I could scrape for material, but nothing shouted out at me as something that could be useful to the average user. Then, I found this awesome website called Pokeapi.co, which allowed me to easily pull data on any Pokemon, including attacks, hit points, and type effectiveness. Once I found this site, I started thinking about an application that could be useful for Pokemon players just like me.

Initially I was going to allow the user to select a Pokemon and give some basic information on said monster, but with the amount of current Pokemon exceeding 1000, I felt like a faster application that could be used in the heat of battle would make more sense. That is how I came to create the Pokemon Type Battle Stat Tracker.

For more information and a demonstration, please see the video below.

TECHNICAL HICCUPS

The biggest struggle about creating this application was how to take the information from the API and manipulate it so that the user would see the correct information. Each API spits things out a little differently so the examples we went over the past few weeks weren’t 100% perfect for grabbing my information.

I spent some time on Google and found how to add on to the .map method in Ruby to pull all of the information I needed and return the information in a clear coherent way for the end user.

type_weakness=type_stats[:double_damage_from].map { |h| [h[:name], h[:url]] }

The next problem that needed to be solved was how I would display nil values to the end user is no types were outputted for a given pokemon. I was able to solve this my looking at my notes from the course and use .length == 0.

HAPPY MOMENTS

I still think there are some improvements to my code and I can expand on the program itself significantly, including if a Pokemon has two different types or a “search by Pokemon” tool. With that said, I was able to add colors and additional formatting to make the program as more pleasing for the end user.

I appreciated the help and assistance that I received from my other peers in the course and was thankful for all of the lessons, lectures, and assignments that we already completed in the class. Without that support, I probably would not have made it through.

Stay tuned for more updates on my journey through the Flatiron School.

--

--

Michael Werling
Michael Werling

Written by Michael Werling

0 Followers

Computer Engineering Student

No responses yet