2013-02-25

CSC 104 Slog-Week Four (Jan 28th - Feb 3rd)

CSC 104 Slog-Week Four (Jan 28th - Feb 3rd)
Something new learned in the class:
[About the history of computing]
  Programmable VS Electronic As for electronic computing, it began by storing information in vacuum tubes.
  Problems of vacuum tubes: consumed huge amount of power, unreliable when warmed up, took up huge amounts of space. Also, they were big, hot and slow compared to transistors.
  By 1970s, the computing power of eniac fits in your hand.
  By 1980s, mass-produced desktops landed with a clunk.






[About the Dr.Racket Program]
  Racket events how to make a timer (We use a fish as the hand, which is kind of funny!)



Challenges I met this week
  Didnt quite understand the terms of developing a timer at first. However, after watching the videos and reading the textbook online I got understand it.
The terms that I summarized from this:
-big-bang function takes one or more parameters: the first parameter is the first image the animation should show, and any remaining parameters are event handlers.
OH NO! So many stuff to memorize!

- Event handler* is a functions for the animation to call whenever a certain event happens. There are several kinds of events: draw the screen, clock tick, mouse activity, keyboard activity, etc.
-to-draw function is an event handler (drawer handler) whose job is to decide what to show on the screen at each step.
- show-it is a built-in function and a draw handler which takes in an image and returns it unchanged. This means that whenever Dr.Racket needs to redraw the screen, it will show the current image.
    e.g. (big-bang pic:calendar (on-draw show-it 300 200)) develops an animation that displays an unchanging picture of calendar on the top-left corner in an window which is 300 pixels wide and 200 pixels high.
-on-tick function is a tick-handler which will be said as (on-tick function-name interval). It is called every time the clock ticks. The interval parameter is how many seconds there should be between one tick and the next. If we leave it out, the animation will run as fast as it can. The function-name parameter is the name of any function that takes in an old image and returns a new one. We can write a function ourselves to do this job or just use the one thats already built in.
  e.g. (big-bang (overlay pic:calendar (rectangle 100 100 solid white))
               (on-tick rotate-cw 1/2)
               (to-draw show-it)

Summary helps you understand these better!
NOTE THAT
-This is no differ
ence in writing (to-draw) or (on-tick) first.
-Technically, on-tick and to-draw are not functions, but rather something called special forms. What this means in practice is that we cant use them anywhere except as an argument to big-bang.
Specific tips to develop a timer
-DISK is a timer disk
 Define it as a outline of a white circle which has the image-width of the BAR.
-SH-SPEED is a speed in degrees/second
 Define SH-SPEED (/ 360 60)
-rotate-second produce image after 1 second rotation.
-rotate1 produces image rotated by 1 degree.


The test/quiz/assignment

Luckily I totally understand the quiz and got a perfect in the quiz. Hopefully I’ll do as well as this time next time.
I am Miss Happy~

❤Feedback to other's blogs
This I read   's blog. She said that "With more knowledge about the Racket Program, I use it more frequently to check my work and practice defining commands. "
Feeling that this is a really good way and hopefully we can stick it to the end! So I left a message: "Practice is always the best teacher for us!" :P

No comments:

Post a Comment