Skip to content

Commit 93cd3f4

Browse files
Add state diagram
1 parent 432b543 commit 93cd3f4

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

exercises/split-second-stopwatch/instructions.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,25 @@ The stopwatch has the following functionality:
99
- Previous laps: retrieve the previously recorded lap times
1010
- Reset: stop time tracking, reset the current lap, and clear all previously recorded laps
1111
- Lap: add the current lap time to the previous laps, then reset the current lap time and continue tracking time
12+
13+
You can think of a stopwatch as being in one of three states:
14+
15+
1. Ready
16+
2. Running (tracking time)
17+
3. Stopped (not tracking time)
18+
19+
This is a visualization of the states (between square brackets) and the commands (between angular brackets):
20+
21+
```text
22+
<lap>
23+
+-----+
24+
| |
25+
<start> v | <stop>
26+
[Ready] ---------> [Running] --------> [Stopped]
27+
^ ^ | |
28+
| | <start> | |
29+
| +------------------------+ |
30+
| |
31+
| <reset> |
32+
+-----------------------------------------+
33+
```

0 commit comments

Comments
 (0)