# State Machine In Real Life

Subscribe!

My latest posts can be found here:
Previous blog posts:
 This page has been Tagged As Story, Tagged As Maths, Tagged As Software
Some time in the first half of 2016 my wife and I were travelling. We stayed in a reasonably comfortable but very inexpensive hotel, and meals weren't provided. As it happened, across the way was a large retail park with a large well-known supermarket chain, and they had a restaurant.

So we had breakfast there, and if we'd been out during the day and wanted an early night, we'd have dinner there as well. There was enough variety for this to be OK for the few days required.

I say it was a restaurant, but actually it was a canteen. There was a counter where you took a tray and passed along, collecting cakes and desserts, until you got to the till where you ordered any hot food and hot drinks, and paid. The hot drinks were provided immediately, you were given a table number indicator, and you went to sit at a table. Then when your food was ready, it was brought to you.

We ate there four or five times, and I noticed that they were using a finite state machine. It went like this.

• You ordered, paid, and went to your table with the table number;
• Your food was brought to you;
• Some time later they would return and ask if everything was OK;
• Then they would take the table number(!)

Can you see the absolute genius in the design of this work-flow?

Suppose you are a member of staff. You can't remember everything about every customer, but you can periodically scan the tables and immediately know the state:

• People, table number, no food,
• ... they are waiting for their food.
• People, table number, food,
• ... go and ask if everything is OK,
• ... and remove the table number.
• People, no table number, food,
• ... leave them alone.
• No people and dirty dishes,
• ... clear and clean the table.

So of course, I upset the system.

On the last two occasions we were there, when they brought our food I gave them the table number indicator. Cue deep confusion ... that is not supposed to happen. But I explained that we'd prefer to be left alone, and that if we needed anything we'd come and ask.

It was apparent on the faces of the staff that this was most unexpected ... members of the public weren't supposed to know how the system worked ... how could I possibly have known ?!?

But it was a real-life example of a finite-state machine, beautifully designed, and extremely effective.

Until I broke it, of course. But they didn't seem to mind too much.

 <<<< Prev <<<< Coxeter Once Nerd Sniped Conway : >>>> Next >>>> Being Slow To Criticise ...

You can follow me on Mathstodon.

## Send us a comment ...

 You can send us a message here. It doesn't get published, it just sends us an email, and is an easy way to ask any questions, or make any comments, without having to send a separate email. So just fill in the boxes and then

 Your name : Email : Message :