Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   recursion, HELP PLEASE.... (http://www.alice.org/community/showthread.php?t=505)

miogi 11-19-2006 05:39 PM

recursion, HELP PLEASE....
 
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 11-19-2006 06:09 PM

Just remember the Geek Dictionary definition:
"Recursion: See Recursion" :)

The thread [url]http://www.alice.org/community/showthread.php?t=484[/url]
may help - it has an example of recursive code I did.

Also try looking up recursion in Wiki - it has a prettly good section.

Shadow Sovereign 11-19-2006 07:20 PM

[QUOTE=DrJim;1766]Just remember the Geek Dictionary definition:
"Recursion: See Recursion" :) [/QUOTE]

I knew there was a [I]Nerd[/I] Dictionary, but a [I]Geek[/I] Dictionary? Now that's big! :p

miogi 11-20-2006 04:06 AM

thanks guys
 
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

DrJim 11-20-2006 07:54 PM

Recursion: See GeekonCall
 
1 Attachment(s)
You're making it [B]way[/B] too hard just because it sounds that way. :p

I suggest you look at the attached code and run the world a couple of times. Then [I]delete[/I] the "if block" and [I]reenter it yourself [/I] - you will get a warning from Alice that you are about to make a recursive call, that is, [B]the method is calling itself[/B]. Say you know what you are doing (even if you don't :D ) and run the world again. If you did it right, :) you should get the same result. If you don't, :confused: 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).

a002329 09-18-2010 03:36 AM

Need help with Recursion.
 
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

bmarh 09-18-2010 10:30 AM

Sail to Island
 
1 Attachment(s)
My boat do not stop at the island


All times are GMT -5. The time now is 05:48 PM.

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