Friday, 22 March 2013

Wikipedia (again) and Recursion

Today was the deadline for the last part of the Wikipedia project. Honestly, I cannot say this has been one of my favorite parts of the course. However, it certainly has been instructive. Now I have a better understanding of the way Wikipedia works and of the process that goes into creating one of the articles. In that sense my feeling is that this was a helpful and useful learning experience. I hope I have done a good job. I personally think that I did, but it is really hard to be a good judge for something you have never done before.
On the other hand, one of my favorite parts of the course so far have been recursion exercises. I did get the hang of them fairly quickly and I enjoy working on them. I also find them to be mentally stimulating to a certain degree. One of my favorite parts about them is trying to figure out and predict what a certain code will create for big numbers, as for example in (t 10). Sometimes this is easy and straightforward, but other times it is not. Since my career is most likely not going to involve computer science, this is for the moment the only use I have of them, but the simple logical concept behind recursion can also be used to solve some everyday tasks that would be harder or more tedious to solve using other methods. And this is another reason why I like recursion. I like the core concept behind it, the concept of making a hard/long task a lot simpler just by repeating the same simple process over and over again.

Friday, 15 March 2013

Test 2

I have not much to say about this week. Everything is going well with the course, and I am happy with my choice. The material is getting more and more interesting, the assignments are going smoothly and I overall feel this is a good learning experience. Test 2 was this week. I think it went pretty well. In fact I think it went better than the first test, in which I did really well too. I am going to start focusing a bit more on the final Wikipedia assignment now, just so I get a bit ahead with it as the end of the semester is going to be really busy.

Friday, 8 March 2013

Project 1

This entire week I've been working on the first project. As I've said before, the project was a very interesting assignment. I liked working on it, especially on the ball. One reason for this might be that I completed the ball fairly easily and with no problems. I got it to bounce around and respond to key presses without encountering any major problems.
I am however having a problem with the ecosystem. The problem seems to be at the function to update the ecosystem. I have written the function as described by the expression, however the problem is that the ecosystem only seems to update once, and not repeatedly every second as it should. I have seen on Piazza that many other students are encountering the same problem. So far I have not been able to come up with a solution, even though I have tried to write the update function in different ways. The end result seems to be the same, the ecosystem updates once, then stops and DrRacket happily tells me that all the tests have passed. It is quite puzzling. The first update seems to be accurate, but everything stops after that. I am not ruling out that it might be a problem with my DrRacket or my computer somehow, although in the case of the bouncing ball everything seemed fine. I also double-checked the big-bang code and everything seems to be fine with that.
Everything I've tried so far does not seem to work. I am confident all my codes are correct (DrRacket at least approves to this to some extent when it comes to the check-expects) but I am at a loss to explain what might be causing this defect. I will for now keep trying, but I feel I am running out of options.
UPDATE
I have finally figured it out, and yes, it was a problem with my codes. My initial code for the update used the MICE-START and FOXES-START number as the number of the mice and foxes in the ecosystem. For some reason, I had decided that the (ecosystem-foxes and mice eco) was unneeded. I was thinking, DrRacket is doing the initial update as it is supposed to. So then why does it not keep updating the ecosystem? The problem of course was that MICE-START and FOXES-START were just two numbers, the initial numbers. DrRacket should do an update after 1 second, and then whatever number comes up for both foxes and mice has to be the new number of mice and foxes in the ecosystem. DrRactket then feeds this number into the next update, does the calculations again and so it goes on. Using FOXES-START and MICE-START was really disingenuous in this way, because those numbers do not update. They are just the initial numbers, so DrRacket was not updating just once, but when it was feeding the FOXES-START and MICE-START numbers back to the update function nothing was changing. DrRacket was then updating every second, but the update was similar to the one before. That got me thinking there has to be another way of doing this, these numbers are just the start numbers, they are not the number of foxes and mice in the ecosystem at any given moment. So I went back and downloaded the starter code again which reminded me of the the (ecosystem-foxes eco) and (ecosystem-mice eco) that I had previously deleted, and that's when the light-bulb came on. I just switched those in place of FOXES and MICE-START in my code and now everything works. Finally.