I’m going to try to make a blog post every day or every other day briefly going over what I’ve been doing in C#. Weekends may be rough due to working 12+ hour shifts, but I’ll try.
The past couple days I’ve been working on the first project in the C Sharp Academy course. You have to make a math game as a console app. Well, if you can remember my last blog post, I used to be completely dumbfounded when I opened VS to a blank template. Not anymore. Now I’m just somewhat dumbfounded..
I didn’t plan any of the game at all, one thing I’m learning is that’s kind of a mistake. Even something simple like a console math game, at least for beginners like me, probably should be planned. The application itself I created with a GameEngine class and a GameLogic class. I did the same for my web scraper as well, however this time I ran into some issues.
I had to read up on static and void as my methods in my classes couldn’t communicate due to some null errors. I trudged on, creating more methods to add and subtract, set difficulty, number of questions and a timer. Then I realized I had way too many methods and it was hard to utilize them for one addition game, let alone subtraction, multiplication, and division. I needed a refactoring.
I learned about method arguments and rewrote my code in Program because the class files were just messing my code up. With it in Program, I will be able to break it up into classes once I know it’s working. From then on, with my next project, I will plan it out first before doing. Granted, I may not know what I’m planning but that’s ok. I will learn eventually.