Alice Community  

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

Thread Tools Display Modes
I need help with conversion function
Junior Member
Status: Offline
Posts: 4
Join Date: Jan 2012
Location: usa
Default I need help with conversion function - 04-06-2012, 11:02 PM

I answered this question, but i need to complete using the conversion function.

pls help me

Question :

In the world below, the row of skeletons (Spooky) is guarding the gate (Spooky). Every so often in this world, the row of skeletons is to reverse order. This project is to animate the reversal using the second form of recursion. The storyboard goes something like the following:

If the row of skeletons not yet reversed is more than one then
reverse the row of skeletons starting with the second skeleton (by recursively calling reverse)
move the head skeleton to the end of the row

The base case is when there is just one skeleton in the row (that has not yet been reversed). Of course, a row of 1 skeleton is already reversed! The recursive case (for n skeletons, where n is larger than 1) says to first reverse the last n−1 skeletons and then move the first skeleton to the end of the row.
Implement the Skeleton reversal storyboard given above. The program you write should be quite similar to the Towers of Hanoi program, including the which function.
Attached Files
File Type: a2w Reversal.a2w (3.53 MB, 18 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 ©2023, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.