Lessons I Took From a Simple Rock-Paper-Scissors Game

Introduction:

If you’re an experienced guy, then you probably will laugh at me for writing a blog post about such a simple project. I mean really? Rock-paper-scissors? You can bang out such a game in your dream, and the code will compile the next day!

But this was my first non-trivial project, where I had to use my wits and all I had learned. I did it back in 2021, and today, I am here to tell you what kind of lessons this small project taught me.

Number 4: The more complex the behavior, the more complex the code.

This is one of those obvious lessons, but it takes time to sink such things into your mind. Mostly because you have to be exposed to these lessons over and over again for them to stick in your mind.

Generally, the code for the game is simple. It mainly consists of conditionals, and switch statements, with a bit of randomness thrown in for the good measure. There is one game loop of course, and that is pretty much it.

But despite that, it takes a lot of lines of code to describe such simple concepts. Mostly because the computer doesn’t understand a lot of things. you have to be very specific. That is what I learned, and I got to experience it with this project.

but of course, then I went on to add more features. first, it was rounds: play five rounds of the game, and whoever wins the most rounds is the winner. then I added the functionality to ignore the draws. and then, I improved the interface.

naturally, this also expanded the code size even further.

Number 3: It is fine to have a simpler version of a project at first.

Initially, I implemented this game in Python. But then I decided to implement it in JavaScript and HTML. I didn’t understand DOM back then, and to some extent, I still don’t have a complete grasp of it. so, I decided to use functions like alert() and prompt(). Maybe it was not the best-looking thing on the web. But again, my goal was not to design a best-looking RPS game anyway. my goal was to get this thing working, and that’s it.

Number 2: You need to be motivated to work on it constantly until its completion.

Having said that, I didn’t want to keep the alert() and prompt() forever as the interface of the game. I wanted to improve its interface and make it better. but somewhere along the line, I kind of lost track, and got demotivated. The fact that I started my blog, started my job hunt, and my family’s pressure to quit the dreams of working in the IT field was getting to me. and that pressure has still not relented. And the job hunt is still going on. Finding your first job as a blind person is quite hard, so I didn’t expect it to be any other way.

But all these factors sapped my motivation, and I did not improve the interface of the game until this year. I told Chat GPT to show me some small examples of DOM manipulation, and after I was done with those, I improved the interface of the game.

Initially, I thought of adding radio buttons for the three of the choices. But then I decided that the buttons were much better. and thus, the game took its final form.

Number 1: but once everything is done, and works, the feeling of accomplishment is great.

And this is exactly why I love software development. This is my work. I didn’t have to rely on anyone else. No one took pity on me and did this work for me. if someone goes through my GitHub, they will never know that a blind guy wrote this game.

All those Google searches, all those moments of bashing my head on the poorly written examples of JavaScript to handle the DOM, it was all worth it in the end. Because my game worked. Not only did it work, but it worked just the way I wanted it to work.

And this is the feeling I would like to remember moving on in my career. Not only to do high-quality work, but to also keep me motivated, and feel the rush and excitement of a personal project that works after all the effort you put into it.

So, these are the things I’ve learned from making a game of Rock-Paper-Scissors. You can play this game here. do you have a special project like this one? if yes, then share it in the comments. Please share this article, and I will see you in the next article.

-Tanish.

Did you find this article valuable?

Support Tanish Shrivastava by becoming a sponsor. Any amount is appreciated!