miogi Guest   Status: Posts: n/a recursion, HELP PLEASE.... - 11-19-2006, 05:39 PM hello, I am kinda blind when it comes to programming. I am taking a computer course that has programming in it and I am having great difficult in understanding lots of elements in this Alice Program. We have a big asignment on trying to catch a butterfly with a net and I have to use Recursion. I have tried to understand chapter 8, but feel it is not coming easy.. I was wondering if you could point me in the right direction such as give me a few example worlds or any info I could use to get me started with this. I have to hand my code in very soon a couple of days and I am lost! I am not asking for you to give me the answers, just a way that I could understand it better. a few simple example worlds showing recursion with calling a method and maybe calling a parameter.. Please help if you can... Lost with Alice.... Miogi
 DrJim Guest   Status: Posts: n/a 11-19-2006, 06:09 PM Just remember the Geek Dictionary definition: "Recursion: See Recursion" The thread http://www.alice.org/community/showthread.php?t=484 may help - it has an example of recursive code I did. Also try looking up recursion in Wiki - it has a prettly good section.
Guest

Status:
Posts: n/a
11-19-2006, 07:20 PM

Quote:
 Originally Posted by DrJim Just remember the Geek Dictionary definition: "Recursion: See Recursion"
I knew there was a Nerd Dictionary, but a Geek Dictionary? Now that's big!

 thanks guys
 miogi Guest   Status: Posts: n/a thanks guys - 11-20-2006, 04:06 AM hey, just wanted to say thanks, I have actually looked at that file regarding recursion, I dl'd it before, but still trying to understand how to code such a thing and where to start. With everything else going on at School, it is hard to just sit down and give Alice another 15-18 hours of time .. lol, sometimes the biggest thing is to just get started.. My instructor went over it slightly in class, but I feel he went to fast for my brain. He put in some recursion with numbers and generated some hugh number(still dont understand what he did, lol) But anyhow, A code that is done such as Fibonacci is hard to understand. If someone has a small code with recursion that I could look at, just a sample of how to start with it, or even how to start with my butterfly one, that would be great.. Peace to all... Miogi
 Recursion: See GeekonCall
DrJim
Guest

Status:
Posts: n/a
Recursion: See GeekonCall - 11-20-2006, 07:54 PM

You're making it way too hard just because it sounds that way.

I suggest you look at the attached code and run the world a couple of times. Then delete the "if block" and reenter it yourself - you will get a warning from Alice that you are about to make a recursive call, that is, the method is calling itself. Say you know what you are doing (even if you don't ) and run the world again. If you did it right, you should get the same result. If you don't, compare your code back to the original.

Note that you have to have the "if test" there or it will run forever (or at least until your computer wears out or you pull the plug).
Attached Files
 GeekonCall.a2w (899.5 KB, 728 views)

Last edited by DrJim; 11-20-2006 at 07:59 PM.

 Need help with Recursion.
 a002329 Guest   Status: Posts: n/a Need help with Recursion. - 09-18-2010, 03:36 AM Create a sea world with a boat and an island. Position the island some distance away from the boat, as shown in Figure 8-26. Write a method named sailTo, which has an Object parameter. The method should cause the boat to move one meter toward the object and then recursively call itself until the boat has reached the object. Test the method by calling it and passing the island as the argument
 Sail to Island
bmarh
Guest

Status:
Posts: n/a
Sail to Island - 09-18-2010, 10:30 AM

My boat do not stop at the island
Attached Files
 Sail.a2w (1.11 MB, 259 views)

 Thread Tools Display Modes Linear Mode

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops General Discussion     Questions and Comments     The Lounge