Kidding, kidding.
Week 7, in a nutshell:
1. While doing A2 I learned a huge amount about the actual application of recursion-related concepts we've been learning for the past month.
2. I also did not sleep very much. On top of A2 I had to prepare and give a research poster presentation for another course, as well as writing a midterm.
3. I'm not going to pretend that anything else really happened CS-wise during week 7 apart from working on A2, at least for me. The lab was cancelled, so I didn't do the lab. I didn't even start studying for the midterm until after handing in A2, which is probably bad but I couldn't have imagined doing it any other way... which is also probably bad. That's awkward.
4. At one point, there were so many students crowded around the outside of Prof Horton's office for office hours that other profs came by and asked if this was some new "Occupy Bahen" movement.
5. I am so very glad I got all my code written sooner than I did for last assignment, since the debugging for this assignment took WAY, WAY longer. Everyone who has ever said that recursive code has a much bigger potential to go wrong than non-recursive code was VERY RIGHT. So basically, I learned my lesson from last assignment and did finish my code earlier, but still ended up stressed out with eleventh-hour debugging escapades because of the sheer amount of debugging that had to happen this time round. Oh well - if I *hadn't* learned that lesson, I would certainly not have gotten the program to run in time, so I am profoundly relieved that I did.
6. These items are getting a little run-on and self-indulgent (who ever heard of a blog being run-on and self-indulgent? hardy har har) so I'm going to separate the next bit into categories kind of after the style of a debugging journal.
Notable bugs experienced:
1. Ok so my recursive function was structured so that if the depth required to actually return a value that made sense was greater than a certain pre-determined value (self.depth, incremented each time the function recursed), the function would randomly choose a move. However, there was a problem with that such that the random move wasn't actually random, and this took me awhile to realize, because at first I thought "OH, THE RANDOM MODULE'S JUST DOING A BAD JOB."
Lesson learned: When the problem could be a builtin module, or could be your code, it's probably your code. Don't give yourself the benefit of the doubt.
Outcome: Eventually I fixed this bug. The day the assignment was due. It was intense but it worked out. However, it wouldn't have been that intense if I'd not given myself the benefit of the doubt in the beginning.
2. Five letters in one line of code in one method (apply_move) meant that our grid was never being updated when the players made moves. This was very stressful, as might be evident.
Lesson learned: Before angsting about code not running, READ THROUGH EVERY SINGLE LINE OF THE METHODS BEING CALLED ONCE AGAIN, and check for stupid, stupid errors.
Outcome: Eventually we found it, by doing the above. However, we could have solved it sooner if the above had been our initial response rather than wringing our hands and panicking. :-)
3. This isn't really a bug, but it resulted in bugs: I used too many helper functions for minimax, and it got really really confusing, just logic-wise.
Lesson learned: The simplest solution is best.
Outcome: I went to see Prof Heap in office hours, and he told me as much (the simplest solution being the best, that is), and I fixed the code. However, this was a bit inefficient because all in all, my partner wrote 1 version of minimax followed by me writing 4 subsequent versions of it before it actually made any sense. All part of the learning curve, I realize - and our understanding has greatly improved over the past 2 weeks. However, the lesson learned is still a good one to bear in mind.
... Now, obviously more bugs than this occurred but these were the three most memorable issues in our process.My computer has 2% battery left, so I'm not going to write about my midterm studying process; instead, I'm going to actually go study for the midterm. Toodles.

No comments:
Post a Comment