Blog: Keogh Code: And then there was maths
- — 09 May, 2012 22:00
I'm not bad at maths. Really, I'm not. I was always pretty good in school, and I continued taking stats in seventh form - or year 13, I suppose - even though I didn't have to. It's just that since I left high school, and went on to complete an English degree followed by a year of Journalism, I haven't exactly had to do a lot of it. And algebra? I haven't done any serious algebra since I was maybe 17.
Anyone who's learned how to program in any in-depth way will understand why this is a problem. While the C++ book I've been working from insists that I don't need to be a mathematician, I know that I'm not going to be able to get away with avoiding the topic altogether for much longer. This become abundantly clear when on Saturday I began to learn about the different variables I could use in C++, and how many bytes of RAM the different variables would use.
Granted, seeing as I'm a complete beginner and everything I'm making at the moment runs in the command prompt, how much RAM a program uses is not going to be of huge importance just now. But at some point, eventually, it might be. And I think that my lack of mathematical prowess might be my biggest hurdle in the weeks to come.
Thankfully, I've recently discovered Khan Academy, a helpful resource with loads of maths help.
For now, though, my problems are simpler - because of my success in making a calculator two weeks ago, when I last wrote a blog, this week I started turning other programs into calculators. The goal was to do it without having to check my old code, and without looking at the book. In other words, I'm teaching myself to code from memory, because while it's a skill I might not need now, it's definitely something I want to be able to do.
While I can now write that 'Hello World' program I struggled with a few weeks ago from memory, I have trouble with things I've learned more recently. It took me an age to change a program that calculated the area of a 10 x 13 rectangle into a calculator that would allow you to input your own numbers to figure out an area. Fortunately, my Assistant hinted that maybe I needed to use a standard other than cout, and eventually I got there. My brain may have come close to exploding in the meantime, but I got there.
Another, more specialised programming book arrived for me this week. From now on, I'll be mixing up my learning switching between my two books, depending on what I think I'm capable of and what's going to be fun to do. This second book gets you started on making basic games in C++, so next week I'm going to have a crack at making my first game.