Sunday, 9 February 2014

Week 5

Week 5

This week in class, the three stool version of Assignment 1 and names/scopes were reviewed in class. The three stool version of Assignment 1 basically showed how to use recursion in moving the cheeses, demonstrating the base case of one cheese, and the application of recursion for more cheeses. This seemed clear to me, and it was very helpful in doing step 5 of Assignment 1, where I had to solve the game for four stools instead of three. The second thing from class was names and scopes. This showed me the importance of using good, specific names for functions and variables. There were also no readings for this week. :)

The main thing I worked on outside of class was A1. After dealing with several problems, I think all I have to do now is run the pep8 checker. One issue I had was directly related to the names/scopes topic covered in class. In ConsoleController.py, there was a function called move. In my play loop function, I also had a variable called move. When I wanted to call the function move in play loop, I kept getting an error that said strings were not callable. I did not know what this meant at first, but then I realized that my play loop function was referring to my variable move (inside the function) rather than the function move (outside the function). This error was fixed by changing the name of the variable move inside the play loop function. Another problem I had was with Tour.py. When I first wrote my solution (and remembered to have a base case), I found myself in the “endless loop” situation. This took a while for me to figure out, but eventually I saw that I had mistakenly hard coded a value into the recursive part of my solution. After fixing that, and a few other small things, my solution worked, and I was relieved.


The last paragraph of my entry is the part where I randomly pick two other slogs to read. The first upon which I happen to stumble is http://c3reiner.blogspot.ca/. Like one of the slogs I read last week, this person has a background in another programming language. He or she (I don't know who this is) seems to think that Python is too simple in that its simplicity sometimes gets in the way of common practicality. Since Python is the only language I know, I don't have an opinion on this. But like I said in last week's entry, I am curious to see how other languages work. (Also, there is a funny picture of two lizards at the bottom of this person's entry (at least I think they are lizards)). This second slog is http://csc148slogss.blogspot.ca/. This person seems comfortable with Object-oriented programming. This person also found the directions for the first lab/tutorial confusing, and I felt that way too when I was doing the lab. And like me, Python is the only programming language this person knows.

No comments:

Post a Comment