Skip to main content

Portia’s Puzzle

Challenge: In Shakespeare’s The Merchant of Venice, Portia had three caskets, gold, silver, and lead. Inside one of the caskets was her portrait. Her suitor must choose the casket with the portrait to claim Portia as his bride. Portia has the following words written on the caskets and tells the suitor that of all the statements, only one is True( Please see the image). In this activity, you will create an algorithm to find the True words and the correct casket based on clues. Code the VR Robot to drive around the Art Canvas +playground to “click” the True and False buttons under each statement to indicate it is True or False, and click the Select button under the correct casket to indicate that the portrait is in this casket. To click a button, drive to it and use the Pen to fill the area with color. 

  • Download the Portia’s Puzzle activity worksheet as a PNG file from this Google slideshow.
  • Select the Art Canvas+ Playground and upload the Portia’s Puzzle activity worksheet.
  • Design an algorithm to find the True statement and the correct casket based on clues.
    • Use a number to represent a casket.  Use variables to store the numbers.
    • Use a variable to represent the casket with the portrait. 
    • Set the value of the variable representing the casket with the portrait to one of the three numbers representing the caskets. 
    • Use the comparison and logical operators to express each statement and report whether it is True or False. Use a variable to store the reported value( True is 1, False is 0).
    • Check how many statements are True., If only one statement is true, this casket is the correct casket, otherwise, set the value of the variable representing the casket with the portrait to a number representing another casket. Repeat the actions until the program finds the correct casket.
  • Code the VR Robot to drive to the True or False button under each statement, use the VR Pen to fill the True button area with green if the statement is True, otherwise,  fill the False button area with red.
  • Code the VR Robot to drive to the Select button under the correct casket, and use the VR Pen to fill it with the same color as the casket to indicate that the portrait is in this casket.
  • Use the [print] block to print the name of the correct casket and the True statement to the Print Console.

Helpful Hints

  • Use the Equal to comparison operator block from the Operators category to report if the portrait is in a casket

    VEXcode Equal to block comparing two custom Variable blocks that reads 'PortraitCasket = GoldCasket'.

    • Matching Python command:

      PortraitCasket == GoldCasket
  • Use the Not  logical operator block from the Operators category to report if the portrait is not in a casket

    VEXcode Not block containing an Equal to block comparing two custom Variable blocks, that all together reads 'not PortraitCasket = SilverCasket'.

    • Matching Python command:

      not PortraitCasket == SilverCasket
  • Use the if then else if then else block from the Control category to code the VR Robot to perform diverse behaviors based on the statements conditions.

    Empty VEXcode If then else block that is extended once and reads 'if then, else if then, else'.

    • Matching Python command:

      if condition:
      	pass
      elif condition:
      	pass
      else:
      	pass