Starting this project was a major struggle for me. Conceptually, I understood how files interacted with one another, but it wasn’t until I put it into practice that it really clicked how during the initialization process, you give your class characteristics and only then can it go out into the big bad world of code to show off what it’s made of. If you as the programmer, don’t give your class the ability to have a name, it just won’t have one. That is both a comforting and an anxiety inducing thought. Ha!
So, to start off, my command line interface (CLI) was based off of the Mountain Project website that is maintained, in large part, by REI, but can be added to by individual users. Kind of like Stack Overflow. The website includes a TON of rock climbs all throughout the U.S. (https://www.mountainproject.com/area/106527199/dougs-roof) Every state is covered. At first, I was thinking I would scrape every single state and allow the user to pick whatever climb they were looking for and then archive it as a completed climb so that every rock climber could have a sort of “accomplishments list”. This was very unrealistic as I soon found out how difficult that would be.
Scraping sort of happens in levels and to do what I had originally had wanted to do – I would have had to scrape at least 10 levels deep. SO, I decided it would be better to choose one area of climbing at my favorite park in upstate New York, The Shawanagunks. I narrowed down my program to only list climbs available at Dougs Roof in Shawanagunks state park. And to be even more specific, we said to only list boulder routes. The world of climbing is pretty big and there are multiple different types of rock climbing. Including but not limited to: top rope, bouldering, lead climbing, sport climbing etc. So by narrowing it down to bouldering, we ended up with about 19 routes at Dougs Roof. A route is one specific climb. Also known as a problem.
The program starts by welcoming the user. Then, requireing the user to type “enter” to continue or “exit!” to leave the program if they have for some reason arrived here by mistake. So, under the hood, I wrote an if else statement here to say okay, if the input we recieve is == “enter” then scrape the mountain project and list the climbs at Dougs Roof that match the criteria that is bouldering. Else the user types exit! – leave the program. Assuming our user wants to be here, we list out the climbs and then send them another prompt that says “Select a climb by typing in it’s number:”. We get that user input again and if it matches a number from the list, we return the climb type and the star rating. Climb type includes how tall the boulder is and star rating is how other climbers have rated the climb before you on a scale from 1-5. At any time, you can exit this program by typing “exit!” and the following line will be displayed to you: “Thanks for stopping by. May the Sharma force be with you.” Chris Sharma is a majorly badass rock climber who makes crazy noises while he climbs. I only found it appropriate to give him a nod.
There were a couple of gems I found really helpful in this process. They include: tty and colorize. Tty allowed me us to some ascii art in the intro. Ruby doesn’t recognize back slashes in code. It thinks you’re just telling it to write a blank space. Once I figured this out via Stack Overflow, I googled around forever trying to figure out how to make a cool picture appear at the start of my program and just could not figure it out. That’s when I found the tty gem that takes care of this for you! It really was a life saver and made my program look way cooler. Overall, this process was super exciting. A tough start, but I had a bunch of moments where I’d wake up in the middle of the night and realize how I needed to fix a bug. :) Thanks for reading and I hope this was helpful to you on your journey!