Skip to content

Commit c801dbb

Browse files
Start improving instructions
1 parent 93cd3f4 commit c801dbb

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed
Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,24 @@
11
# Instructions
22

3-
Your task is to build a stopwatch that can be used to keep track of lap times.
4-
The stopwatch has the following functionality:
3+
Your task is to build a stopwatch to keep precise track of lap times.
54

6-
- Start: start/resume time tracking
7-
- Stop: stop/pause time tracking
8-
- Current lap: retrieve the time tracked for the current lap
9-
- Previous laps: retrieve the previously recorded lap times
10-
- Reset: stop time tracking, reset the current lap, and clear all previously recorded laps
11-
- Lap: add the current lap time to the previous laps, then reset the current lap time and continue tracking time
5+
The stopwatch uses four commands (Start, Stop, Lap, and Reset) to keep track of two things:
126

13-
You can think of a stopwatch as being in one of three states:
7+
1. The current lap's tracked time
8+
2. Any previously recorded lap times
149

15-
1. Ready
10+
What commands can be used depends on which state the stopwatch is in:
11+
12+
1. Ready (initial state)
1613
2. Running (tracking time)
1714
3. Stopped (not tracking time)
1815

19-
This is a visualization of the states (between square brackets) and the commands (between angular brackets):
16+
| Command | Begin state | End state | Effect |
17+
| ------- | ----------- | --------- | ----------------------------------------------------------- |
18+
| Start | Ready | Running | Start tracking time |
19+
| Start | Stopped | Running | Resume tracking time |
20+
| Stop | Running | Stopped | Stop tracking time |
21+
| Lap | Running | Running | Add current lap to previous laps and then reset current lap |
22+
| Reset | Stopped | Ready | Reset current lap and clear previous laps |
2023

21-
```text
22-
<lap>
23-
+-----+
24-
| |
25-
<start> v | <stop>
26-
[Ready] ---------> [Running] --------> [Stopped]
27-
^ ^ | |
28-
| | <start> | |
29-
| +------------------------+ |
30-
| |
31-
| <reset> |
32-
+-----------------------------------------+
33-
```
24+
TODO: add example of flow

0 commit comments

Comments
 (0)