THE WELLESLEY CUCKOO CLOCK

The Code

To program the Wellesley Cuckoo Clock, we used a language called Handy Logo. For those of you who might want to take a look, below is the code Cathie wrote to run our baby. If you'd rather just see the final result, click here.

Or, you could return to the home page.


global [hour-count]

 

to cuckoo-motion

sethour-count 0

loop [waituntil [half-past < 210] repeat 2 [babies-event]

waituntil [o'clock < 210] owl-cuckoo]

end

 

to babies-event

babies setpower 3

babies thatway onfor 3

wait 8

babies thisway onfor 3

wait 8

end

 

to owl-cuckoo

sethour-count (hour-count + 1)

ifelse (hour-count = 12)

[repeat 12 [owl-event] sethour-count 0]

[repeat hour-count [owl-event]]

end

 

to owl-event

owl setpower 7

owl thatway onfor 4

wait 3

owl thisway onfor 4

end

 

to half-past

output sensor 1

end

 

to o'clock

output sensor 3

end

 

to babies

b,

end

 

to owl

a,

end

 

 

Created by: Carrie Ryan
Date created:  January 24, 2000
Last Modified: January 25, 2000

Mr. Owl