DEV Community

Ririio
Ririio

Posted on • Edited on

Adding new features

For my final release for the course, I would be working with a repository that I worked on during hacktoberfest called battlemath. This one has a fairly simple goal in mind, and that is to teach children with math. My first feature that will be implemented is a "difficulty" selection. This is fairly similar to their already existing mode selection for the operators. The difference is that, it will change the values that will be used.

As the image below dictates, it would be standing side by side to the already existing "mode-selection", and will contain 3 difficulties.

Image description

Each difficulties should only change the numbers, and follow the corresponding operator

Medium
Image description

Hard
Image description



Later down the line, I will try to implement two new modes for 'decimals' and 'factoring', which will change the entire functionality of the game, which I find a tad difficult to implement, but we'll see how it goes.

Similar to the previous implementation, it will also be a new mode selection, but it's much more complex than the previous, because it has to change not just the numbers, but also how the entire calculation is done.

I imagine the new addition to be similar to this...

Decimals/Hard
Image description

Factoring
Image description

While writing this blog, I come to realize the difficulty of adding a "factoring" mode. I will try to implement it as best as I can, but I'm a bit worried if I would be able to finish it in due time.

Starting up

My first thought about how I should tackle this is to read through the entire code and understand how everything works, but I realized that working at random is not going to help me understand anything. Therefore, I went ahead and look through only those that are directly connected with the feature that I will be implementing.

For the case of this project, they already have a 'mode' selection, which made my life a bit easier in terms of figuring out how I should implement mine. I noticed that for larger projects, it's best to back track on everything. What this mean is that to read through a code, and look at what it does from the inside, and keep going until you reach an end. For my case everything ends at the "object" that contains all the values for the operations. Once I figure out how the selection work, I can create my code base on my understanding from that.

Top comments (0)