Game Atlas CLI

Camrynpatterson
3 min readJan 11, 2021

With all of the ups and the downs that I have had with this project, it is a very bittersweet feeling finally completing my CLI program. I had fun writing all the code, and I loved every second of crafting my project. But even though I loved it, that doesn’t mean there weren’t times where it frustrated me to no end. With all of the frustrations, I learned a lot more than I knew before starting this project. I’m honestly very happy about the few head scratching moments I had, trying to figure out why my CLI wasn’t working, because it helped me become a better programmer, and gave me a reason to feel proud about my work. I’m going to tell you a little bit about them.

Scraping

For my program, I utilized scraping and Nokogiri to parse through HTML in order to supply users with the most sold video games on different consoles. I used Wikipedia for my application’s information, and that was a real challenge for me. I thought it would be easier than it was, but I was dead wrong. This was the most challenging part of development, and I spend more time on scraping than I did coding my application’s interface and behavior. I couldn’t for the life of me figure out how to scrape a hyperlink to use for the console name, or one release date that I needed. I tried to use two separate links for scraping, but all that did was break my program. I finally decided to use my scrapes carefully and conservatively, and use it mostly for game names and release dates (except on the one I couldn’t).

This is a snippet of code I wrote for one of the consoles I have on the menu. I used instantiation to create all of the consoles, which was a breeze. But not too breezy was being stuck for a couple hours on Wikipedia trying to make everything work perfectly. I pushed through and finally figured out this way of writing my program — using the scraping technique AND text.

My CLI File

This was my absolute favorite part of development. My CLI file includes the code I wrote to create the behavior and interface of my application. It starts out with a call list, and every input a user can interact with is listed. My program works by the user choosing either 1, 2, or 3.

This snippet of code includes the code that allows the 1, 2, and 3 method to work correctly. Initially I had it only as “if input.to_i > 0” without the “&& input.to_i < 4” but when you would input a number higher than 3 in the terminal, the program would break, instead of my written error message being displayed. This did have me scratching my head for a bit, and after a while of googling, I finally figured it out! The rest of the code shows how the chosen (1,2, or 3) inputs will be displayed to the user.

Though it was a challenging couple of weeks, I am proud of myself that I actually got through this, and persevered even in the tough times. I’m excited for the next project, and to learn even more in the meantime. Thanks for reading!

--

--