Sunday, September 15, 2013

3rd Week of Class



    Well, another week has come and gone, and I for one am so glad it’s over. Partly due to my poor planning and a few other things out of my control, I ended up with a project pileup (Collatz being one of them) at the end of this past week, but thankfully I was able to get it all done. My only real regret is that I didn’t leave myself enough to finish the extra credit part of project 1. I get the unpleasant feeling that I’m going to want all the extra credit I can get my hands on this semester.

    Speaking of Collatz though, the project turned out to be as simple as I had hoped after all. I had initially been wary about using Git, but after you commit a couple of times, it becomes really easy to get the hang of how to use it. Being able to update your repo that easily is nice, but honestly I became a fan after using its issue tracker system for a bit. I’m pretty sure using it is the sole reason I got every single part of this project done. Usually, I have a knack for forgetting some of the fine details, but being forced to keep track of my goals like this really helped keep me focused.

    The entire project wasn’t smooth sailing, unfortunately. I ran into couple of errors throughout the course of my work that were exceptionally annoying yet stupidly easy to fix once you figured out what you needed to look for. The prime example would have to be the stack overflow error I kept getting while trying to implement my lazy cache. After about an hour of head banging the desk, I finally stumbled upon a solution. I had been initializing an array to hold a million ints for my cache within the function used to evaluate the largest cycle length of the pair of input ints. It seems that C++ has some sort of limit as to the size of arrays or other objects within an individual function which resulted in a stack overflow whenever I ran the program. Instantiating the array outside of the function and making the cache array a global variable seemed to fix the problem, though. I guess this is just one of the little quirks of C++ that I’ll have to learn through trial and error.


No comments:

Post a Comment