Doctor Black has just been found dead in his bedroom. He has been knocked down by a heavy metallic object, most likely the candlestick that was found on the floor next to Doctor Black. When falling down, Doctor Black broke his watch which stopped at 8:14 PM. We can assume that this is the time of death.
Doctor Black’s bedroom is the master bedroom and is located on the first floor.
Our crime scene investigator took some notes to recap the key facts:
At this time of the day there were only four guests in Doctor Black’s mansion. They are the prime suspects:
- Miss Scarlett
- Reverend Green
- Colonel Mustard
- Professor Plum
Our crime scene investigator interviewed all four suspects and gathered some facts about their whereabouts around the time of death.
He has decided to create an algorithm based on these facts to help him solve this murder mystery. To do so he has translated each fact into pseudo code as follows:
Fact:
Pseudocode:
IF TimeOfMurder >= 6:00PM AND TimeOfMurder <= 8:00PM THEN MissScarlett = "Innocent" ProfessorPlum = "Innocent" END IF
Below is our crime scene investigator’s full algorithm:
Will it help you solve this crime?
IF TimeOfMurder >= 6:00PM AND TimeOfMurder <= 8:00PM THEN MissScarlett = "Innocent" ProfessorPlum = "Innocent" END IF SELECT CASE LocationOfMurder: CASE "1st Floor": ReverendGreen = "Innocent" CASE "Ground Level": MissScarlett = "Innocent" ColonelMustard = "Innocent" CASE "Garden" ProfessorPlum = "Innocent" IF (MurderRoom == "Kitchen" OR MuderRoom == "Master Bedroom") AND timeOfMurder >= 8:00PM THEN ProfessorPlum = "Innocent" ELIF MurderRoom == "Bathroom" AND (timeOfMurder >= 8:00PM AND timeOfMurder <= 8:30PM) THEN MissScarlett = "Guilty" END IF IF MurderWeapon == "Candlestick" OR MurderWeapon == "Rope" THEN MurdererGender = "Male" END IF
And the murderer is …