barracuda time piece

Modeling events in racket/scheme

Some videos on how to model events. Start with models that are images that respond to clock ticks, keystrokes, or mouse events. Move on to use more complicated models to simulate ever-richer universes.

racket simple event video

Make a barracuda image change by rotating it every tick of the clock. This is a first step to using big-bang to create worlds that respond to events. Of course there are problems, technical details, at the beginning... Once you're done with the video, you should be able to

  • Make a barracuda switch from regular to mirror image on every tick of the clock
  • Define a new function (shrink90 im) that scales im to 90% of its size, and then use your function shrink90 with big-bang to make a barracuda (or any other image you choose) shrink at each tick of the clock

Some relevant non-video resources:

racket smoother event video

Use big-bang and create a new function rotate-second to get a barracuda to rotate at a speed, and in a direction, suitable for the second-hand of a watch. Nearly tamed that barracuda! After watching the video, you should be able to:

  • Create a new speed WORLD-SPEED which is the number of degrees you would need to rotate each second in order to rotate a full 360 degrees in 24 minutes... Some arithmetic required to figure out how many seconds in 24 minutes. Once you've done that, create a new function (rotate24 im) that rotates im a complete 360 degrees every 24 minutes. Now capture an image of planet Earth (a view from the pole might be nice), and use big-bang to make it rotate every 24 minutes... 60 times faster than usual
  • Some non-video resources:

racket key event video

That barracuda can be made to rotate about its tail and the timer can be made to stop in response to a keystroke.

racket complex event video

More than just a twirling barracuda — successively-slower twirling pencil and arm — can add live to a simulation

racket transparent event video

Images typically arrive on pale rectangular backgrounds. Make these backgrounds transparent so that you can have one thing in front of the other.


Danny Heap
Last modified: Tue Oct 1 14:42:56 EDT 2013