Learn Practice Daily golf Reference
Operators·Lesson 7 of 7·9 min·0/5 exercisesPro

Ship the kitchen display

The whole of track three against the clock: cut and change, copy and reorder, then fix the shape, on the new kitchen display.

Scene

Thursday, 11:15 a.m. The new kitchen display ships at noon. The cooks have already unplugged the old one, so if this doesn't work, lunch is cooked from tickets taped to the wall.

Forty-five minutes, one file, and the whole language: verbs, nouns, numbers and the jar.

From memory

Warm-up from earlier chapters

Two from earlier chapters, from memory, before the new idea. Two wrong tries show the answer.

Uppercase the word under the cursor.
press the keys…4 keys
1 of 2
Uppercase the word under the cursor.

The whole language, on one card

Verb, then noun: d c y > gU with any motion. Say the verb twice for the whole line, use D and C for the rest of it, put a number wherever it reads best, and remember the jar: whatever you yank or delete, p pours back.

t)
log("shown", ticket.id, debugInfo(ticket));
f)
log("shown", ticket.id, debugInfo(ticket));
$
log("shown", ticket.id, debugInfo(ticket));
b
log("shown", ticket.id, debugInfo(ticket));
One verb, four nouns, from the same cursor. Pick the one that covers exactly what has to go.
Boss round

Stage 1 · Cut and change

11:16. The top of KitchenDisplay. Somebody started this class from a copy of the old showTicket before Monday's fix, and copies = 3 came along for the ride. Nothing calls show yet, so no cook has seen it; at noon, everything will. The parameter goes. So does the legacyMode line, rnder gets its missing letter, and the debugInfo call leaves the log. One sentence each.

Stuck? Show a hintlegacyMode line: dd · from the comma before copies: dt) · rnder: ciwrender<Esc> · from the comma before debugInfo: df)
1 of 4Delete the line marked red
1export class KitchenDisplay {
1 private tickets: Ticket[] = [];
2 private legacyMode = true;
3 private brightness = 80;
4
5 show(ticket: Ticket, copies = 3) {
6 this.tickets.push(ticket);
7 this.rnder();
8 log("shown", ticket.id, debugInfo(ticket));
9 }
10}
NORMALLoading the editor…1/40.0s1:1

This exercise needs a keyboard. Read on, and play it at your computer.

Boss round

Stage 2 · Copy and reorder

11:31. render draws before it clears, and the header lands under the tickets. Move screen.clear() up above the first draw, swap the two draws so the header comes first, then copy the rows draw and make the copy draw the footer.

Stuck? Show a hint
Pro
The rest of this lesson is in Pro

The first exercise of every lesson is free. Pro unlocks the rest, every track, for good.

See Pro

This exercise needs a keyboard. Read on, and play it at your computer.

Boss round

Stage 3 · Shape

11:52. The Formatter got here before you fixed its config. CLEAR should be the method name clear, and the two lines inside it go back in one level.

Stuck? Show a hint
Pro
The rest of this lesson is in Pro

The first exercise of every lesson is free. Pro unlocks the rest, every track, for good.

See Pro

This exercise needs a keyboard. Read on, and play it at your computer.

The display drawsFinish the exercise above to see it.
From memory

The whole language, from memory

Seven sentences from this week.

Delete till the next closing bracket.
scroll here, then press the keys3 keys
1 of 7
Delete till the next closing bracket.

Extra practice optional

The chapter is done. These rounds keep going as long as you like: stop whenever it stops being useful.

Endless

Kitchen display, live

Endless mixed repairs from the whole track: cut, change, copy, swap, join, shape.

Pro
The rest of this lesson is in Pro

The first exercise of every lesson is free. Pro unlocks the rest, every track, for good.

See Pro

This exercise needs a keyboard. Read on, and play it at your computer.