Stepping up the PR game

It the second week of October, and that means it's time to submit another Pull Request for hacktoberfest. This time i wanted a bit more of a challenge than my previous PR that was just fixing a small UI constraint issue. I decided to search GitHub for an issue that involved me getting more into the code, but also something that i could start and finish within a reasonable time.

After about an hour of research, i found a very old repo that hadn't been updated in 11 years. The repo was for a very simple online version of the board game Go. I looked through the submitted issues and found that someone had posted an issue that they wanted a feature that would allow them to save the game progress. This seemed like the perfect issue for me to work on because its a very simple game that i could understand and more importantly, i could understand the code. So i forked the repo and cloned it to my local machine and got to work.

First i started by running the game locally and playing it to see how it worked and what could and could not be done in the current game. Once i had a general idea on how the game works and the rules, i started looking into the code and how the data is passed around in the application. Needless to say, that task took longer than i was expecting but no matter, it was finally time to see how i could implement the functionality to save the game progress. I needed to find which parts of the data needed to be saved in order to save the state of the current game. Luckily i found that the person that wrote the code originally was saving the data that i needed in a matrix, an array of arrays basically.

Now that i had the data that i needed, it was time to decide on what type of persistent storage i was going to use. Setting up some sort of database somewhere that would store the data was out of the question, one, i was too lazy to go though the hassle of setting all that up and two, i didn't want to have to find a place to host it. So the next option was local storage, and because i didn't want to have to spend time to make sure the code works on different machines and different operating systems, i ended up just using the browsers built-in web storage. I did a bit of research on googles documentations on how web storage works, and how to use it. I also used some of the example codes that were provided and modified them to work for what i needed it for.

After a solid few hours i had finally written and tested the code that would allow the users to save their progress in the game. Once again, it was time to submit another pull request to the original repo owner, which i explained how todo in a previous blog that can be found here. Next week i'm going to implement the functionality to actually load your game so you can continue from where you left off, so be sure to look for that new blog coming soon.

Comments

Popular posts from this blog

Hacktoberfest is just around the corner

Finding issues by accident

Filing issues and pull requests using git hub