Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Cuckoo Clock Recursion
Old
jwehrly
Junior Member
 
Status: Offline
Posts: 1
Join Date: Sep 2013
Question Cuckoo Clock Recursion - 09-12-2013, 08:23 AM

Hello, my project is to create a cuckoo clock using recursion. Now I understand how recursion works and I have created the methods for this project but I cannot figure out how to create the IF/ELSE statement to end the loop when the user interacts with the running program. My exact assignment was written like this:

Chapter 8
Page 260, #7

On the Hour
Place a cuckoo clock (Objects) in a new world. Be sure to set the scene which means that you should select a room (look in Environments) as the backdrop for your scene as you certainly would not hang a cuckoo clock in the open air.

The idea of this animation is to have the cuckoo clock keep time (not in real time, of course). The minute hand should go around on the face of the clock (perhaps one complete revolution should take about 30 seconds in real time) and the pendulum should swing back and forth continually. When the minute hand has made one revolution (from 12 back to 12 [one revolution] on the face of the clock), then the hour hand should advance to the next hour [1/12 of a revolution], the doors should open, and the cuckoo bird (on the clock arm) should come out and chirp once. Then the bird should retreat inside the clock and the doors should close until the next hour has gone by. “All is well” as long as the clock is running—which should continue until the user stops the animation. Use a recursive method to implement the animation. Recall that ‘recursive’ means that the method calls itself. This world does not require any changes to Events but it does require a method to move the clock [cuckooClock.keepTime()] hands and another to control the cuckoo [cuckooCLock.cockoo()].

Any help is greatly appreciated.

V/r
Jwehrly
Attached Files
File Type: a2w Chapter7.a2w (873.1 KB, 61 views)
   
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2020, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.