Problem Solving: Decision tables
Decision tables are compact and precise ways of modelling complicated logic, such as that which you might use in a computer program. They do this by mapping the different states of a program to an action that a program should perform. Decision tables take on the following format:
The limited-entry decision table is the simplest to describe. The condition alternatives are simple Boolean values, and the action entries are check-marks, representing which of the actions in a given column are to be performed.
A technical support company writes a decision table to diagnose printer problems based upon symptoms described to them over the phone from their clients. They type the following data into the advice program:
- Printer does print
- Red light is flashing
- Printer is recognised
The program then uses the decision table to find the correct actions to perform, namely that of Check / Replace ink.
|Conditions||Printer does not print||Y||Y||Y||Y||N||N||N||N|
|A red light is flashing||Y||Y||N||N||Y||Y||N||N|
|Printer is unrecognised||Y||N||Y||N||Y||N||Y||N|
|Actions||Check the power cable||X|
|Check the printer-computer cable||X||X|
|Ensure printer software is installed||X||X||X||X|
|Check for paper jam||X||X|
Let's take a look at a computer game example, for a football simulation the following rules are set up.
What happens when:
Answer: Keep Playing and give them some extra time
This question is open to interpretation, but you should have something resembling this:
Determine logical conditions and consequential actions.