 Due date: 9/25 @ 6pm Problem 0 [5%]:
Find one interesting article from the weeks news on the use of
software/computers in society. Summarize the article in your own words
with a single 200word paragraph, as
a pair, one playing writer, the other playing editor. Add both the article
and the summary in with the rest of your problem set.
The goal of this problem set is to practice designing data representations
using structures and functions for processing such forms of
data. Furthermore, you must follow the design recipe and the guidelines
when you develop functions.
HtDP Problems
6.3.1, 6.4.1, 6.5.1
Problem A1
Here is a data definition for keeping track of time on a clock (which we
know is a computer with a display attached to it):
(definestruct time (hours minutes))
;; Time = (maketime Number Number)
;; Constraints:
;; The first number is always between 0 and 11;
;; the second number is always between 0 and 59.
Use these definitions for the following exercises:

Design the function
tock from Time to Time .
It adds one minute to the given time.

Design the function time>text, which converts a time to a
text. The text should look like the display of a common alarm clock,
i.e., it should separate the minutes from the hours with a colon. Hint: a
text is an image, not a string, but you will need a string
version of the time, too. See HelpDesk (image.ss) for text.
 Optional: After you have developed these functions, you may wish to add the
following lines to your program:
(bigbang 100 30 .1 (maketime 0 0))
(ontickevent tock)
(onredraw time>text)
If you do, be sure to delete them before you turn in
your solution. We will subtract points if you leave them in.
Problem A2
You've found a summer job with the pyschology department.
They'd like you to develop a program that helps people
control the movement of a ball across the screen. (They
wish to study brain models and reaction times and this is
just a small part of it.)
The ball can move on straight lines only, that is, up, down, left, or
right. Mouse clicks change the ball's location.

Develop a data representation for the current position
of the ball. The position is best described with a pair of
positive integers.

Develop a data representation for velocity of the ball.
You may assume that the ball always moves exactly 10 pixels
at a time but remember that velocity also includes the
direction of the movement.

Develop a data representation for the ball.

Design the function
ballnext , which consumes (the
representation of) a ball and create a ball that represents where it
will be after one "tick." (Hint: If a car is 100 miles from Boston's
center and travels at 60 mph in the exact direction of this point, how
close will it be after 1 hour of traveling? Now generalize this to a ball.)

Design the function
ballimage , which consumes
(the representation of) a ball and produces a rectangle of 300 x 300
pixels with a red dot (diameter 10 pixels) placed at the ball's
position.

Design a function
ballchange , which consumes a ball,
two numbers (x and y), and a symbol (s). If s is 'buttondown, the function
creates a ball that moves in the direction of (x,y); otherwise, the function
returns the given ball.
 Optional: After you have developed these functions, you may wish to add the
following lines to your program:
(bigbang 300 300 (/ 1.0 28)
aballinsidetherectangle)
(ontickevent ballnext)
(onredraw ballimage)
(onmouseevent ballchange)
If you do, be sure to delete them before you turn in
your solution. We will subtract points if you leave them in.
