Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
The Kitchen, dish, dishwasher algorithm
@startuml
start
note right: Agent enters the kitchen to bring back a dish (e.g. glass, cup, mug, plate, ...)
if (Dishwasher running?) then (yes)
:Put dish into sink;
stop
else (no)
if (Dishwasher full?) then (yes)
if (Dishes in dishwasher clean?) then (yes)
:Put clean dishes back;
note left: Longest running operation
:Put as much dishes from sink into dishwasher as possible;
if (Dishwasher full?) then (yes)
:Start dishwasher;
:Put your dish into the sink;
stop
else (no)
:Put your dish into dishwasher;
if (Dishwasher full?) then (yes)
:Start dishwasher;
stop
note left: Worst case
else (no)
stop
endif
endif
else (no)
:Put dish into sink;
:Start dishwasher;
stop
endif
else (no)
:Put dish into dishwasher;
if (Dishwasher full?) then (yes)
:Start dishwasher;
stop
else
stop
endif
endif
endif
@enduml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment