RoboMind Projects - Exercises, May 1, 2012, Cardinal Forest Elementary School

RoboMind website
RoboMind Example scripts
RoboMind Basic instructions: move, paint, grab, see
RoboMind Programming Structures: comment, loops, if-structures, procedures, end
Back to RoboMind Projects

Original version, see Robo Exercise Set 1

also see

  • RoboMind example scripts/programs

    ROBO Exercise Set 1
    Arvid Halma from robomind.net
    June 8, 2011

    1. Exercise 1: Moving the beacon:

      Open default.map

      Use the remote control (Run > Remote Control) to move the beacon located south east of the robot to the south west corner.

      Part 2 - write the script yourself. Type the commands yourself and run the script.
      The Remote control version will have more lines:

      	1 ...
      	2 forward(1)
      	3 forward(1)
      	4 forward(1)
      	5 ...
      
      and your version:
      	1 ...
      	2 forward(3)
      	3 ...
      

    2. Exercise 2: Drawing Stairs
      Use the remote control to draw stairs like the one below:
      Stairs with three steps:

      Part 2, Use a repeat loop to draw the three steps Let the robot take one step at a time

      	1 # Start to paint
      	2 repeat(3)
      	3 {
      	4 	# Draw a single step
      	5 }
      	6 # Stop painting
      

      Part 3: Use a procedure
      Create a procedure drawStairs() that draws the three steps like the previous exercise.

      procedure drawStairs()
      {
      
          # draw the three stairs here
      
      }
      
      drawStairs
      
      

      Part 5: Make this procedure work for any number of stairs

      procedure drawStairs(numberOfStairs)
      {
              repeat(numberOfStairs)
             {
      	
      	#  draw each stair
      	
              }
      }
      

      Hint:

      	1 drawStairs(2)
      	2
      	3 procedure drawStairs(number)
      	4 {
      	5 	# draw stairs with ‘number’ steps.
      	6 }
      
      This draws stairs with two steps.
      By changing line 1 to drawStairs(5) it makes the robot draw five steps.

    3. Exercise 3: Follow the white marks
      Open the map goRightAtWhite1.map
      Follow the white painting marks.

      Map 1:


      Here are the steps:

      • Move forward until you see one right in front of you.
      • Then turn right at the spot.
      • Move forward until you find another white spot.
      • Turn right at this spot.
      • Keep doing this until you hit a beacon.

      Write one script that works with all the maps:
      goRightAtWhite1.map, goRightAtWhite2.map, goRightatWhite3.map

      Map 1:

      Map 2:

      Map 3:

    4. Exercise 4: Draw a spiral
      Part 1
      First version Write a script that draws a spiral until you can’t go any further because there is an obstacle in front of you.

      Hint:

      paintWhite
      repeat {
          repeatWhile(rightIsWhite) {
              if( ???) {
                  forward(1)
              }
              else {
                  end
              }
          }
          right
          forward(1)
      }
      
      

      Part 2:
      Second version
      Use recursion to draw the arms of the spiral.
      Hint: first make a procedure that lets the robot move along one arm of the spiral.