Operation Down!

Your mission, should you decide to accept it, is to define a fruitful function named moveDown that has four parameters (inputs), representing a row, column, and two colors. It returns an integer (an updated row value). It should perform the following four steps:

  1. Invoke the function changeColor and supply three arguments (inputs): the row, column, and first color (a simple version of changeColor is provided for testing)
  2. Increase the value of row by one. If it reaches 10, change it to 0
  3. Invoke the function changeColor again, and supply three arguments (inputs): the new value of row, column, and the second color
  4. Return the new value of row

Write your function definition on the whiteboard set aside for your team. After your definition has been cleared by one of your mission leaders (Scott or Anna), implement and test your function as follows:

Operation Down

When your moveDown function is complete, six headers will appear below with row, column and color displayed for each call to the changeColor function (there are three calls to moveDown in the testing code, and this function calls changeColor twice)

When you're done, upload the code file to the MI6 folder in the public_html directory of the cs110d account. Your mission leaders will give you the password.