Teachpacks for How to Design Programs
Ping-Pong
pingp-play.ss
The teachpack pingp-play.ss
implements a demonic ping-pong
game. The goal is to keep the ball in play as long as possible. The ball
bounces on the northern and southern walls but must be kept in play with
the paddles at the eastern and western walls. The paddles can be moved
with mouse clicks. Occasionally a demon blows the ball into a different
direction so that the game becomes more interesting. Enjoy!
The teachpack provides one major operation:
It also provides four operations that change properties of the game:
Sample session: Set teachpack to pingp-play.ss
execute and
play:
> (go 'MyName)
> (change-speed 120)
> (go 'MyName)
> (change-wind 88)
> (go 'MyName)
pingp.ss
The teachpack pingp.ss
provides the graphical help
functions for a student implementation of the demonic ping-pong game:
The use of the operations is explained in detail in subsection 5.3.