From: pedro oliva Date: 2013-06-08T05:42:04+09:00 Subject: Re: Need help understanding recursion. Thanks Alphonse!! That is exactly the help I needed and definitely helped clear up some things on this program. At first I was not sure as to how the tiles were being marked a counted. Now my issue im not to sure how the program proceeds to count beyond the adjacent tiles. For example: #we started with continent_size(world,5,5) #size=1 here, and now mark this tile as 'counted tile' and continue on to size = size + continent_size(world, x-1, y-1) # 1(size) + (recursion call with new parameters to continent_size(world, 4 (5-1), 4 (5-1) Now at this point do we run the line of code we just ran with the new (world 4,4) parameters and continue to recursively run this till we get to the base case? In essence keep continuing counting the tiles that are in a down-left direction till we run out of land to count? Or Do we move on to the next line of code which would be: size = size + continent_size(world, x , y-1) and pass the (world, 4,4) parameters that we got from the first line of code, then continuously pass the same parameters all the way down the rest of the code in the following lines? size = size + continent_size(world, x+1, y-1) size = size + continent_size(world, x-1, y ) size = size + continent_size(world, x+1, y ) size = size + continent_size(world, x-1, y+1) size = size + continent_size(world, x , y+1) size = size + continent_size(world, x+1, y+1) Thanks for the quick replies and all the help. Tamara and Brandon, Does The Little Schemer apply to Ruby or is it all Scheme?? -- Posted via http://www.ruby-forum.com/.