Saturday 1 March 2014

Assignment 1

    For A1, I jumped right in and implemented a small portion of the method headers and the code for each one.  Little did I know that I had left out several other methods that we were supposed to implement.  Only after careful inspection of the code already written in the TOAHModel, did I realize the other methods we were responsible for implementing.  By then I had already designed and finished implementing the play_loop() in ConsoleController.  I had found that the __str__() method did not work as intended with the return statement, so I changed the "return lines" into "print(lines)" and my play_loop() could correctly print the image of the stools, but did not show any cheeses on any of the stools, despite having already called fill_first_stool() with a number of cheeses.  I returned to the TOAHModel and slowly found the methods I was supposed to implement and returned to my ConsoleController to test if my play_loop() behaved as intended.
    After confirming that my Console Controller was implemented as I intended, I attempted to run the GUIController.  However, I found that the first stool was filled with the desired number of cheeses, but the cheeses could not be selected. I then spent almost 2 to 3 hours looking through the code of the GUIController to see which line of the code the problem was on and searching through the piazza forums to see if someone encountered a similar problem.  I eventually realized that the problem occurred when cheese_location was called.  I had not noticed the error I made when coding cheese_location, as the examples I used incidentally resulted in the correct expected output based on the mis-programming.  I returned to my TOAHModel and corrected the implementation of cheese_location and was capable of playing on GUIController with any number of cheeses without experiencing problems.
    After that one road bump, I moved onto the implementation of tour_of_four_stools. I looked back at the first two pages of the Assignment 1 handout and analyzed the instructions that explained the steps to correctly and efficiently move any number of cheeses on the first stool to the last stool on any four stool problem. I realized that i was the ceiling of n divided by 2 after sifting through the forums and considering different number of cheeses using the formula provided. I solved the four stools problem using three to eight cheeses to see that I could properly move the cheeses to the other side in the least amount of moves. I reviewed the solution that Danny provided us for the three stools problem and realized that I should use a similar approach to implement the code for the solution to the four stools.  After writing a recursive function strictly using four stools to move the cheeses, I realized that I had to use the three stools solution in the second step of the four stools code. I then analyzed the individual steps the function would execute using the python visualizer, and understood which stool was to be which intermediate stool, as there was only 1 correct combination.
    I moved onto the last 8% of the assignment and changed the code to move the cheeses on both the three stools and the four stools to offer a choice to print the string representation of the stools for each move with a user specified time delay. After modifying the original move_cheeses to offer animation and time delay, I simply called the move_cheeses for the four stools and ensured that the animation and the time delay worked as intended. I was then finished, and handed the assignment in after confirmation that everything worked as I expected.

Sunday 2 February 2014

Fourth Week

This week when we covered recursive functions, I had a bit of difficulty understanding in the very beginning. However, as the class continued on and we observed the natured of tree_burst function, I was able to piece together the function's behaviour and understand how the recursion worked. As for the labs of this week, I enjoyed the challenge, and am slowly grasping the form al language used when being instructed what to program in our labs. The motorized class was fun to code and I learned that I need to advocate my ideas more when I have more certainty in my ideas than that of my partner's. I find the idea of calling a function within a function really interesting and useful, but have yet to fully cope with it. I have read over what to do for assignment 1 and am going to crack down and see how much I can complete without consulting piazza.

Wednesday 22 January 2014

Third week

This week I learned how to produce my own exceptions in case of , for example, the user inputting a string whilst using IntStack.  I feel quite confident about the material covered this week and also enjoyed the lab this week despite it being less of a challenge.  I think the lab was a lot more explicit in terms of what we were supposed to do, and found the idea of how to run Queue as efficient as Stack to be interesting. My partner and I had difficulty understanding how to shorten the run time on Queue in the beginning but after much deliberation and a bit of help from the TA, we came up with a possible solution.  Unfortunately we ran out of time, but I later worked on it myself and succeeded in decreasing Queue's run time.

Second week

The course has started quite in the thick of things, and I feel comfortable with all the material covered in lectures.  Our first lab based around Object-Orientated Programming was a bit difficult for me to fully grasp as the lab was rather open ended and the instructions were not as explicit as the exercises per se. I spent a good portion of the lab trying to figure out what we were really supposed to do with my partner, but as we pushed on through following the instructions as best we could, I gained a much better understanding of what was expected of us.

As for the ADTs, the concept was not too hard to grasp, especially after we implemented them as classes in our second lab.  I like the rate at which we cover new material in this course and enjoy the programming exercises provided during our labs.