Operation Up!

Your mission, should you decide to accept it, is to define a fruitful function named moveUp that has four parameters (inputs), representing a row, column, and two colors. It returns an integer (an updated row value). Your function 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. Decrease the value of row by one. If the value of row becomes negative, change it to 9
  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 Up

When your moveUp 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 moveUp 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.