Interactive Parabola Grapher
Explore graph ,equation and the locus of a Parabola
Save graphs to your desktop!



A+    A−    B  
Home
Graphing Calc
Algebra
Math Games
  • Decimals in Space
  • Fraction Balls
  • Integers in Space
  • Math Man
  • Number Balls
  • Geometry
    Interactive
    Trigonometry
    Scientific Calc

    Advanced Topics in Jeroo

    Recursion with Custom Methods

    Recursion in Jeroo

    Recursion 1) Identify the base case in the code below and complete the program so that the recursion works. Start the Jeroo in the top left corner. Your objective is to complete the go() method such that the Jeroo makes its way to the flower and picks it.
    
    method go(){
        if(isFlower(AHEAD)){
            pick();
        }
    else if(isWater(AHEAD)){
        turn(RIGHT);
        hop();
        turn(RIGHT);
        hop();
    //after we turned around
    // call ourself again
        go();
        }
    else if(isNet(AHEAD)){
    //you should do this part
    //do not use any kind of loop 
        }    
    else{
        hop();
        go();
      }
    
    }
    
    Jeroo Activities for recursion
    Download Island Files for these two activities
    The maze below can be solved by employing recursion. Write a recursive method that takes a Jeroo to the flower. The Jeroo should then stop and turn until it is looking south.

    Solution
    Another maze that you should be able to solve with a recursive method.

    More examples of recursive methods

    method recusiveMethod() {
     	if(!isWater(AHEAD))
    	   hop();
    	 else{
    	 	turn(RIGHT);
    	recusiveMethod(); 
       }
     }  
      
    
    
    method recursiveMovement(){
    if(isNet(AHEAD)){
       turn(RIGHT);
       hop();
    }
    else{
     if(isWater(AHEAD) )
       turn(RIGHT);
    else 
       hop();
       recursiveMovement();
          }
    }
    
    

    Recursive Activities