Alice Community  

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

Reply
 
Thread Tools Display Modes
Alice 2.2 Ch7 Ex6 Recursion spiral
Old
brilliantlypsychotic
Junior Member
 
Status: Offline
Posts: 2
Join Date: Nov 2011
Location: las vegas
Question Alice 2.2 Ch7 Ex6 Recursion spiral - 11-30-2011, 10:15 PM

I am attempting to make a spirally increasing pseudo-square using recursion. I can do it with a loop no problem. With the recursion I have my obect going in a constant square without it spiraling out. Help PLEASE!!!
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 12-01-2011, 11:48 AM

Recursion and looping are nearly the same thing, just implement the code you would have used in the loop, then add something at the end of the method that stops it from being called again if a condition is met.

If you want, you can post your world and we can help you do that.


(')>
   
Reply With Quote
Old
brilliantlypsychotic
Junior Member
 
Status: Offline
Posts: 2
Join Date: Nov 2011
Location: las vegas
Default 12-01-2011, 01:28 PM

Ok, here it is. The robot is doing what I want it to do, I just need it to be recursive.
Attached Files
File Type: a2w spaceloop.a2w (2.47 MB, 12 views)
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 12-01-2011, 09:34 PM

Here's the world, but there's a piece missing. You have to figure out what it is.
Attached Files
File Type: a2w spaceloopR.a2w (2.47 MB, 20 views)


(')>
   
Reply With Quote
Old
joncjaffe
Junior Member
 
Status: Offline
Posts: 12
Join Date: Jan 2012
Default 04-16-2012, 09:33 PM

add an index of 1
   
Reply With Quote
Old
TauTrumpsPi
Senior Member
 
TauTrumpsPi's Avatar
 
Status: Offline
Posts: 399
Join Date: Mar 2011
Location: The diamond layer
Default 04-17-2012, 02:43 PM

Quote:
Originally Posted by joncjaffe View Post
-snip-
Yah think there might be a reason that the moderator left that to figure out for himself? People have to learn, and giving them answers won't help.


--------------------------------------------------------------------------------------------------------------------------
I have plenty of common sense. I just choose to ignore it.
-Calvin and Hobbes

Wondering about my Avatar?
http://en.wikipedia.org/wiki/Tardigrade

Wondering about my username?
http://www.youtube.com/watch?v=jG7vhMMXagQ
   
Reply With Quote
Old
joncjaffe
Junior Member
 
Status: Offline
Posts: 12
Join Date: Jan 2012
Default 04-21-2012, 04:13 AM

Not really they were stuck on a certain point; though it through and got stuck point out the obvious is helping.
   
Reply With Quote
Reply

Tags
chapter 7, exercise 6, pseudo, recursion, spiral


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 ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.