Draw a state diagram that depicts a simple system that stacks and unstacks a set
ID: 3858668 • Letter: D
Question
Draw a state diagram that depicts a simple system that stacks and unstacks a set of Russian "Matryoshka" dolls. Matryoshka dolls are hollow wooden dolls that can be separated in two parts, revealing a smaller doll inside, which can itself be separated, and so on, until the smallest, solid doll is reached. The system has four states: ready (dolls stacked), ready (dolls unstacked), stacking, and unstacking. Consider the following details of the system operation: the system will never stack or unstack dolls out of order: dolls are always placed inside the next largest doll. the system can transition between stacking and unstacking mid-sequence: that is, it can switch to stacking again even before all dolls have been unstacked, and vice versa.Explanation / Answer
The states are as follows:
S1-Ready (Dolls stacked)
S2- Dolls (Unstacking)
S3- Dolls (Stacking)
S4- Ready (Dolls unstacked)
S1 -------> S2 (Action - Dolls are being taken out)
S2 --------> S3 (Action - Dolls are being stacked again)
S2 ---------> S4 (Action - all the dolls are stacked out)
S3 -------->S1 ( Action - all Dolls are being stacked again)
S4 ---------> S3 (Action - Dolls re being stacked in)
S3 ----------> S2 (Action - Dolls are being unstacked again)
The diagram looks like:
Dolls(stacking out) Dolls(all stacked out) Dolls(stacking in) Dolls(all dolls stacked in)
S1 --------------------->S2 ----------------------->S4-------------------->S3--------------------------->S1
Dolls(stacking in again) Dolls(all dolls stacked in)
S2 ------------------------>S3------------------------------> S1
Dolls(stacking out again)
S3 -------------------------->S2
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.