The Digital Doctor
Example Courtesy of
Dr. D. J. Furlong, Department of Electronic and Electrical Engineering, Trinity College, Dublin Ireland
and Dr. David Vernon, Carnegie Mellon Africa.
Let's practice a bit of logic by designing an algorithm to diagnose two ailments:
- Boolean Virus
- Digital Flu
There are four symptoms that can be used to diagnose these diseases:
- chills
- rash
- bloodshot eyes
- fever
Here is how to tell what disease a patient has:
- Now, anybody who hasn't got any of the symptoms doesn't have either Boolean Virus or Digital Flu.
- Anybody who has NO chills but HAS only one of the other symptoms has the Boolean Virus,
they need Neominterm now!
- Anybody who has NO chills but HAS any combination of the other symptoms is just suffering from Digital Flu,
so give them some DeMorgan salts and send them home.
- If they DO have the chills, then you've got to look at the combination of symptoms ...
- If there are the chills and a rash, with no other symptoms, then it's the Digital Flu again.
- However, if it's a chill by itself
or a chill any any other combination of rash, bloodshot eyes, and fever
(but not the Digital Flu combination of chills and rash only),
then they've got the Boolean Virus for sure.
Only Neominterm can save them!
After the diagnosis, the following prescription is given to the patient:
IF Boolean Virus THEN
please take some Neominterm,
ELSE IF Digital Flu THEN
please take some DeMorgan Salts,
ELSE
just go home.
Action Plan for in-class exercise
Write an algorithm for this problem.
- Don't forget to use an outline with at least 2 levels.
- Use abbreviations - for instance BV and DF and c, r, b, f, ... Your team should agree on the terms you wish to use.
- Try to keep it simple, yet thorough.
- Put the details in the lower-levels of the outline.