After going through so much midterms, I started working on Project 1. In the beginning, it seemed so confusing because there were so much codes jumbled and mixed together. However, after reading the assignment handout and the instructions written after semi-colons, I slowly began to figure out what I must do. The check-expects I had to add were easy. I breezed through them all. The difficult part was fixing the definitions so that it matches with the previously written check-expects. Fixing "clarify-color" was easy. But, "check-key" function took some thinking to figure out the definition's code. Personally, the hardest one was "clarify-image" command. I tried various things to make it suit not only for the check-expects, but also for the clock hand images. At first I knew a condition code was need in the definition code. It took various attempts which all failed. This was because most of them gave an error of 'in a argument, a number was expected but an image was given.' I was getting really frustrated, but before giving up, I wrote one more code that actually worked for check-expects. Unfortunately, it did not work for the clock because it only showed white circles with alpha value of 0. As a result, after the lecture was over last Wednesday, I asked professor Heap for hints. He advised me to look through the map-image activity he went through. Unable to figure it out even after the professor gave me the hint, I called a friend who took CSC104 with me. He and I thought our brains out but couldn't resolve the issue. In the end, he decided to ask to his TA and left library.
Even after he left, I tried to think what map-image had to do with "clarify-image" definition code carefully. The exercise had "map-image" command and two arguments: another function and an image. I knew that "map-image" was just "map-image", and the image (2nd argument) was the variable c. Then, it hit me. I realized what I need for the 1st argument. Because the condition of r+g+c is greater than 650 was already included in "clarify-color" command, all I had to do was (define (clarify-image c) (map-image clarify-color c)). When it was ran, it worked perfectly. All the check-expects passed through and the clock was working properly with proper clock arm pictures.
Embracing the joy of success and the fact that I finally fixed the issue made my day. However, I soon realized that there was another project. Hopefully, the next project won't trouble me as project 1 did.
댓글 없음:
댓글 쓰기