AS Computing - Unit 1
State Transtion Tables
A state transition table is a means of recording all of the possible states and transitions for a Finite State Machine. Some software modelling tools will generate code or state transition diagrams from such a table.
Let's return to the model we made for the vending machine. The state diagram looked like this,
We can record the states and transitions using the following table,
Input | Current State | Output | Next State |
---|---|---|---|
5p | Got 0 | No can | Got 5p |
10p | Got 0 | No can | Got 10p |
5p | Got 5p | No can | Got 10p |
10p | Got 5p | Can | Got 0 |
5p | Got 10p | Can | Got 0 |
10p | Got 10p | Can | Got 5p |
This model could be extended to accept other coinage and to return change to the customer. Currently, the model only shows what happens when the correct coins are entered.